0

我想做的是绘制一个折线图,显示几个国家之间的比较值。我得到的图表是:

在此处输入图像描述

这里的问题是图例中列出了形状和颜色。我希望图例只是该国家/地区的组(使用形状)和颜色的组合。我正在使用这个位:

ggplot(data=Data,aes(x=Indicator,y=Numeric,group=Country,shape=group,colour=Country))+geom_point()+geom_line()

数据是这样的

    Indicator  Year             Country Numeric  data     group
1   All causes 2008         Afghanistan    1663  3.22  Very Low
2   All causes 2008             Albania     518  8.53       Low
3   All causes 2008             Algeria     591  8.64       Low
4   All causes 2008             Andorra     310 21.25      High
5   All causes 2008              Angola    1685 10.08       Low
6   All causes 2008 Antigua and Barbuda     682  9.07       Low
7   All causes 2008           Argentina     553 14.38    Medium
8   All causes 2008             Armenia     864  6.62  Very Low
9   All causes 2008           Australia     278 16.76    Medium
10  All causes 2008             Austria     335 16.17    Medium
11  All causes 2008          Azerbaijan     918  4.54  Very Low
12  All causes 2008             Bahamas     629 16.80    Medium
13  All causes 2008             Bahrain     408 11.41       Low
14  All causes 2008             Belgium     369 15.10    Medium
15  All causes 2008              Brazil     667  5.86  Very Low
16  All causes 2008          Costa Rica     400 30.61 Very High
17  All causes 2008         Ivory Coast    2567  6.82  Very Low
18  All causes 2008    Marshall Islands    2681 19.46      High
19  All causes 2008         Netherlands     323 19.69      High
20  All causes 2008         New Zealand     312 19.56      High

有人可以指出我可以做些什么来实现这一目标吗?即使我在这上面花了很长时间,我也无法真正分解它。

4

1 回答 1

0

在参数中更改group-> 。Countryshape

ggplot(data=Data,aes(x=Indicator,y=Numeric,group=Country,shape=Country,colour=Country))+geom_point()+geom_line()
于 2013-10-17T10:14:44.127 回答