Code:
# Libraries
library(tidyverse)
# Get data
DataToAnalyze <- readRDS("Latest119thData.RDS")
CountPosts <- DataToAnalyze %>%
group_by(author_lower, party, chamber) %>%
summarize(Total = n())
CountPosts <- CountPosts %>%
filter(party %in% c("Democrat", "Republican"))
ggplot(CountPosts, aes(x = Total, fill = party)) +
geom_histogram(position = "identity", alpha = 0.6, bins = 30,
show.legend = FALSE) +
facet_wrap(~ party, scales = "free_y", ncol = 1) +
scale_fill_manual(values = c(
"Republican" = "#C33C54", # red
"Democrat" = "#254E70" # blue
)) +
labs(title = "Histogram of Total by Party", x = "Total", y = "Count") +
theme_minimal()