抖动似乎没有在ggplot散点图中分离我的观点

时间:2015-07-07 21:17:27

标签: r ggplot2

我试图在使用geom_points制作的ggplot散点图中偏移两个点。我尝试了默认的jitter以及我自己的设置,但在这两种情况下,我都没有看到情节的差异。情节总是看起来像附图,巴西和墨西哥相当拥挤。 我应该做些什么? plot

这是我尝试过的代码:

     p = ggplot(morning_night, aes(x = ascent_median, y = duration_median)) + geom_point(position = "jitter", aes(color=type, shape=region, size=30))
   +geom_text(aes(label=country), hjust = 0, vjust = 1.2) 

    p = ggplot(morning_night, aes(x = ascent_median, y = duration_median)) + geom_point(position = position_jitter(w=.1, h=.1), aes(color=type, shape=region, size=30))
   +geom_text(aes(label=country), hjust = 0, vjust = 1.2)

    p = ggplot(morning_night, aes(x = ascent_median, y = duration_median)) + geom_point(position = position_jitter(w=.1, h=.3), aes(color=type, shape=region, size=30))
   +geom_text(aes(label=country), hjust = 0, vjust = 1.2) 

这是用于此图表的数据框:

country     ascent_median   duration_median type    region
Sweden      41.6            1793    morning Scandinavia
Denmark     33              1960    night   Scandinavia
Mexico      75              1877    morning LatinAmerica
Brazil      74.4            1928    night   LatinAmerica
Indonesia   41.8            1492    morning SoutheastAsia
Malaysia    48.7            2208    night   SoutheastAsia
Switzerland 64.3            2461    morning CentralEurope
Austria     67.9            2113    night   CentralEurope

0 个答案:

没有答案