返回

ggplot2:下划线的阴影区域与 x 轴上的分类数据

发布时间:2022-07-14 09:33:38 379
# edge# 数据

我想在x轴上连接分类变量值的线下有一个阴影区域。

数据:

t <- structure(list(Indicator = c("Performance", "Relationship", "Inter", 
"Culture", "Focused", "Profit", "Knowledge", "Customer", "Lead", 
"Leadership", "Competitiveness"), mean = c(5.11124203821656, 
5.38707537154989, 3.12898089171975, 5.70647558386412, 5.48805732484076, 
5.3343949044586, 5.77547770700637, 6.06488853503185, 5.1156050955414, 
4.97292993630573, 4.323703366697)), row.names = c(NA, -11L), class = c("tbl_df", 
"tbl", "data.frame"))

现在,我有一个带有 geom_line 和 geom_plot 的图:

t %>% 
  ggplot(aes(x = Indicator, y = mean, group = 1))+
  scale_x_discrete(limits = c("Relationship","Inter","Culture","Focused","Profit","Knowledge","Customer","Lead","Leadership","Competitiveness","Performance")) +
  geom_point() +
  geom_line() +
  geom_vline(xintercept = 10.5) +
  ylim(c(2,7)) + 
  theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5),
                       panel.background = element_rect(fill = "white",
                                                       colour = "lightblue",
                                                       size = 0.5, linetype = "solid"))

有办法做到吗?

特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(2)
按点赞数排序
用户头像