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 (将#修改为@)