Skip to content

Instantly share code, notes, and snippets.

@yjunechoe
Last active October 22, 2020 16:02
Show Gist options
  • Save yjunechoe/56913b54f2bfc3c16a9b447f5c156597 to your computer and use it in GitHub Desktop.
Save yjunechoe/56913b54f2bfc3c16a9b447f5c156597 to your computer and use it in GitHub Desktop.
1000 tweets from @everycolorbot
# https://pbs.twimg.com/media/Ek8VZFEVgAAHZM_?format=png&name=4096x4096
colortweets <- rtweet::get_timeline("everycolorbot", 1000)
colortweets_df <- colortweets %>%
select(created_at, text, favorite_count) %>%
mutate(
hour = lubridate::hour(created_at),
hex = paste0("#", str_extract(text, "(?<=0x).*(?= )"))
)
colortweets_plot <- colortweets_df %>%
arrange(-favorite_count) %>%
ggplot(aes(lubridate::hour(created_at), favorite_count, color = hex)) +
geom_col(aes(size = favorite_count), position = "dodge") +
scale_color_identity() +
theme_void() +
theme(
plot.background = element_rect(fill = "#222222", color = NA),
legend.position = 0
) +
coord_polar()
ggsave("everycolorbot_colors.png", width = 10, height = 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment