【发布时间】:2020-12-19 12:32:00
【问题描述】:
我对 R 有点陌生 - 在尝试制作以下情节时遇到了一个非常奇怪的问题
worst_death <- df_clean %>%
group_by(event_cat) %>%
summarise(Deaths = sum(FATALITIES)
, Injuries = sum(INJURIES)) %>%
ggplot()+
geom_segment(aes(x=reorder(event_cat,Injuries),xend=reorder(event_cat,Injuries), y=Deaths, yend = Injuries, color="black")) +
geom_point(aes(x=reorder(event_cat,Injuries), y=Deaths,color="yellow", size=1 ))+
geom_point(aes(x=reorder(event_cat,Injuries), y=Injuries,color="white", size=1 ))+
coord_flip()+
theme_ipsum()+
theme(legend.position = "none",) +
xlab("Event Type") +
ylab("Human Impact")
worst_death
图表运行完美 - 除了颜色和美学选项(大小等)没有返回我指定的内容。
奇怪的是颜色是红色蓝色和绿色,而不是黄色黑色和白色。
有人知道为什么会这样吗?
谢谢
【问题讨论】:
标签: r ggplot2 visualization