df %>% ggplot() + geom_segment(aes(x = x0, y = y0, xend = x1, yend = y1, color = gap), size = 0.1) + geom_point_blur(aes(x = x1, y = y1, color = gap, size = gap)) + geom_point(aes(x = x1, y = y1, color = gap, size = gap)) + geom_richtext( data = df_text, aes(x = x - 500, y = y - 1, label = label, color = gap), fill = NA, family = cnfont, label.color = NA, vjust = 0.85, hjust = 0 ) + scale_color_gradientn(colors = viridis::cividis(100, begin = 0.1), guide = "none") + scale_fill_gradientn(colors = viridis::cividis(100, begin = 0.1), guide = "none") + scale_blur_size_continuous(range = c(1, 15), guide = "none") + scale_size(range = c(.001, 2), guide = "none") + scale_alpha(range = c(.33, 1), guide = "none") + new_scale_color() + geom_richtext(data = df_labs, aes(x, y + 0.5, label = label,color = x), size = 3, family = cnfont, fill = NA, label.color = NA, vjust = 0.85) + geom_text(data = df_labs, aes(x, y + 1, color = x), label = "|", size = 2, family = cnfont, vjust = 1) + geom_point(data = df_points, aes(x, y, color = x), size = 0.001, shape = 20) + scale_color_gradientn(colors = viridis::cividis(100, begin = 0.5), guide = "none") + geom_textbox( data = tibble( x = ymd("1983-01-01"), y = 17, label = "<span style='font-size:20pt;line-height:2pt;'>欧洲各国领导人的在任时间</span><br><i>数据来源:Archigos database & New York Times<br>绘制:微信公众号 RStata<br><br>图中展示了 1979 年以来欧洲各国 382 位领导人的上任、<br>卸任时间以及在任时长,其中卢卡申科(Lukashenko)在<br>任时间最长,从 1994 年上台以来,他已经担任了将近 28<br>年的白俄罗斯总统;普京(Puting)在任时长仅次于卢卡申<br>科,其于 1999 年上任,至今已经担任了超过 22 年的俄<br>罗斯总统。也有很多在任时长非常短的总统,例如博鲁塞维<br>奇(Borusewicz)他仅仅在 2020 年 7 月 8 日这天当了<br>一天的波兰领导人。</i>" ), aes(x, y, label = label), inherit.aes = F, family = cnfont, color = "grey70", lineheight = 1.7, width = unit(6.2, "inch"), hjust = .2, vjust = 0, fill = NA, box.colour = NA ) + theme_ipsum(base_family = cnfont, grid = F) + theme( plot.background = element_rect(fill = "black"), plot.caption = element_text(family = cnfont, color = "grey50", size = 18, hjust = .5, lineheight = 1.1, margin = margin(t = 90)), plot.caption.position = "plot", axis.text.y = element_blank(), axis.text.x = element_blank() )
ggsave("leader.pdf", device = cairo_pdf, width = 10, height = 10) ggsave("leader.png", device = png, width = 10, height = 10)
|
评论