How to create a Bubble chart timeline in R on one horizontal line

走远了吗. 提交于 2021-01-03 07:05:00

问题


I would like to create a bubble chart in R where each bubble represents a mass shooting: casualties Killed and casualties Injuredsomething like the following:

Basically, I want a ggplot2 bubble chart with geom_point on one horizontal line. Without a y-axis, where the size of the points represent the values (Killed and Injured).

For reproducibility, you can find my dataset of mass shootings in the US (2017) in a shared google spreadsheet. (Do note that the terrible mass shooting in Las Vegas is left out for gradual points size purposes, I will add the one later on).

I created the following plot, but as described I would like to have all the dots (killed and Injured) on one horizontal line.

  data_per_date %>%
  filter(Incident.Date != "2017-10-01") %>% # Las Vegas shooting is left out for size purposes.
  ggplot(aes(x = Incident.Date, y = Killed)) +
  geom_point(aes(size = Injured),
             shape = 21,
             colour = "#FF6F00") + # Should be the orange transparant circles 
  geom_point(aes(size = Killed),
             alpha = 0.7,
             colour = "#B71C1C") # The red bubbles

  • P.s. It's quite a lot to ask, I know, but I can't find any timelines like these created with R. You smart people maybe have some Ideas of how to tackle this problem.
  • P.S. 2 I could align the points in a vector graphic tool like Skech or Illustrator but rather want to know how to do this in R.

来源:https://stackoverflow.com/questions/46605742/how-to-create-a-bubble-chart-timeline-in-r-on-one-horizontal-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!