改变火山地块的光滑度

时间:2014-04-18 12:34:35

标签: r ggplot2

我制作了一个火山图,但基础数据有差距,即直方图数据如下:

enter image description here

当我制作火山情节时,它看起来有点傻:

enter image description here

是否可以在阴影区域使用更光滑的方法来熨平罗纹特征;当然,它必须已经具有与之相关的平滑度,否则阴影每次都会回落到0?

代码:

ggplot(fly2[fly2$Region == "different",], aes(x = Probability)) +
 stat_density(aes(ymax = ..density..,  ymin = -..density..),
 fill = "grey50", colour = "grey50",
 geom = "ribbon", position = "identity") +
 facet_grid(. ~ Algorithm) + xlim(0,0.3) +
 coord_flip()

链接到dput文件:

 http://pastebin.com/ba95WEab

1 个答案:

答案 0 :(得分:3)

adjust中使用geom_density

例如,当我使用adjust = 1.6时,这就是我得到的

ggplot(fly2[fly2$Region == "different",], aes(x = Probability)) +
  stat_density(aes(ymax = ..density..,  ymin = -..density..),
               fill = "grey50", colour = "grey50",
               geom = "ribbon", position = "identity",
               adjust=1.6) +
  facet_grid(. ~ Algorithm) + xlim(0,0.3) +
  coord_flip()

enter image description here