4

我想将箱线图中的异常点设置为半透明在这里!他们使用“jitter”(类似的想法,不同的方法)

我的代码

ggplot() + 
geom_boxplot(aes(x = Sistema, y=values, linetype = Sistema), 
             data=estacado, outlier.size=1, outlier.shape=2) + 
coord_flip() + 
labs(x="Sistema", y=expression(paste("RMSD ",(ring(A))))) +
opts(legend.position="none")

我的数据

>head(estacado)
    values   ind Sistema
1 0.310214 r24_a     R24
2 0.428232 r24_a     R24
3 0.460971 r24_a     R24
4 0.482923 r24_a     R24
5 0.492656 r24_a     R24
6 0.515591 r24_a     R24
> tail(estacado)
          values   ind Sistema
4999995 1.723030 g24_e     G24
4999996 1.718444 g24_e     G24
4999997 1.720745 g24_e     G24
4999998 1.737137 g24_e     G24
4999999 1.733106 g24_e     G24
5000000 1.738487 g24_e     G24

http://dl.dropbox.com/u/19202810/Rplot01.png http://dl.dropbox.com/u/19202810/Rplot01.png

在提到的链接中,他们修改了功能geom_boxplot;我希望更简单outlier.colour= alpha("black", 1/2)的事情,但这会产生错误:

Error in do.call("layer", list(mapping = mapping, data = data, stat = stat,  : 
  could not find function "alpha"

任何帮助表示赞赏。

4

1 回答 1

4

ggplot20.9.0 版开始,该alpha功能已移至(当时是新的)scales包中。要使用它,您需要包括

library("scales")

此外

library("ggplot2")

在你的脚本中。

于 2012-05-22T18:34:32.077 回答