微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

R:将选择标签附加到带状图中的多个分量图

如何解决R:将选择标签附加到带状图中的多个分量图

我有如下数据:

> wef_20
# A tibble: 156 x 7
   Country   Year `Economic Participatio… `Educational Attainme… `Gender Gap Sco…
   <chr>    <int>                   <dbl>                  <dbl>            <dbl>
 1 Lao PDR   2021                   0.915                  0.965            0.75 
 2 Bahamas   2021                   0.857                  1                0.725
 3 Burundi   2021                   0.855                  0.896            0.769
 4 Iceland   2021                   0.846                  0.999            0.892
 5 Belarus   2021                   0.84                   0.999            0.758
 6 Guinea    2021                   0.839                  0.68             0.66 
 7 Barbados  2021                   0.837                  0.991            0.769
 8 Latvia    2021                   0.822                  1                0.778
 9 Benin     2021                   0.814                  0.733            0.653
10 Moldova   2021                   0.811                  0.996            0.768
# … with 146 more rows,and 2 more variables: Health and Survival score <dbl>,#   Political Empowerment score <dbl>

使用以下脚本:

library(readr)
library(scales)
wef <- read_csv("Documents/Code/ceda/wef_gg_combined.csv",col_types = cols(Year = col_integer()))
wef_20 <- subset(wef,Year==2021)
list <- list('Gender Gap score'=wef$`Gender Gap score`,'Economic\nParticipation score'=wef$`Economic Participation score`,'Educational\nAttainment score'=wef$`Educational Attainment score`,'Health &\nSurvival score'=wef$`Health and Survival score`,'Political\nEmpowerment score'=wef$`Political Empowerment score`)
par(mar=c(5,10,4,1)+0.1)
stripchart(list,xlim=c(0,1),col=alpha(c("dark blue"),I(1/10)),pch='|',las=1,xaxs='i',cex=1.5,offset=50)

我能够生成这个带状图:

enter image description here

我希望标记一小部分国家(例如印度、中国、美国、日本等几个已定义的国家),它们将出现在条形图上,类似于:

enter image description here

我无法弄清楚如何将一个国家附加到每个组件图上的每个点,然后仅显示几个选定国家的标签

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。