library(ggplot2)
df <- read.csv("Counsumer_Price_Index.csv")
sav <- df %>%
filter(ï..Location %in% c("IRL", "CAN", "AUS",
"USA", "FRA", "DEU",
"ESP", "ITA")) %>%
filter(Time == 2021) %>%
filter(Subject != "Energy")
sav
sav %>% ggplot(aes(x = Percentage, y = ï..Location)) +
geom_point(aes(colour = Subject), size = 2.5) +
geom_segment(aes(yend = ï..Location, colour = Subject), xend = 0 , linetype="dotted") + theme_light()
我想为CPI指数数据绘制一个棒棒糖图,每个国家都有三个类别,如何显示这些类别,使它们不重叠
我想为CPI指数数据绘制一个棒棒糖图,每个国家都有三个类别,如何显示这些类别,使它们不重叠
2条答案
按热度按时间vuktfyat1#
您可以将
position_dodge
与coord_flip
一起使用:laawzig22#
大概是这样的