This plot shows the number of stories per week between January and August 2026 mentioning terms related to teams in the NFL: Chiefs, Niners, Patriots
The data were extracted from Media Cloud queries and analyzed using R.
Here is the R code that produced the plot.
############################################################
# Load packages
############################################################
library(tidyverse)
library(plotly)
############################################################
# Import the three datasets
############################################################
Chiefs <- read_csv("Chiefs.csv")
Niners <- read_csv("Niners.csv")
Patriots <- read_csv("Patriots.csv")
############################################################
# Add team names
############################################################
Chiefs <- Chiefs %>%
mutate(Topic = "Chiefs")
Niners <- Niners %>%
mutate(Topic = "Niners")
Patriots <- Patriots %>%
mutate(Topic = "Patriots")
############################################################
# Combine datasets
############################################################
MediaCloudData <- bind_rows(
Chiefs,
Niners,
Patriots
)
############################################################
# Create Monday-based week
############################################################
MediaCloudData <- MediaCloudData %>%
mutate(
Week = floor_date(
date,
unit = "week",
week_start = 1
)
)
############################################################
# Calculate weekly story totals
############################################################
MediaCloudWeekly <- MediaCloudData %>%
group_by(Week, Topic) %>%
summarize(
Stories = sum(count, na.rm = TRUE),
.groups = "drop"
)
############################################################
# Remove partial weeks
############################################################
MediaCloudWeekly <- MediaCloudWeekly %>%
filter(
Week > min(Week),
Week < max(Week)
)
############################################################
# Create tooltip
############################################################
MediaCloudWeekly <- MediaCloudWeekly %>%
mutate(
Tooltip = paste0(
"Team: ", Topic,
"<br>Week Beginning: ",
format(Week, "%Y-%m-%d"),
"<br>Stories: ",
Stories
)
)
############################################################
# Create interactive graph
############################################################
Plot <- plot_ly(
data = MediaCloudWeekly,
x = ~Week,
y = ~Stories,
color = ~Topic,
type = "scatter",
mode = "lines+markers",
text = ~Tooltip,
hoverinfo = "text"
) %>%
layout(
title = "Weekly Story Counts: Chiefs vs. Niners vs. Patriots",
xaxis = list(
title = "Week Beginning"
),
yaxis = list(
title = "Story Count"
),
legend = list(
title = list(
text = "Team"
)
)
)
############################################################
# Display graph
############################################################
Plot