我试图通过聚簇来创建条件的气泡图,其中每个气泡的大小由第三个“百分比”变量设置。至于per the ggplot2 documentation,我想我应该可以通过scale_size_area来做到这一点。我不清楚为什么这不起作用,当百分比= 0时,我仍然看到非常微小的点。使用scale_size_area(ggplot2)绘制大小为“0”的点为完全不存在
ex <- data.frame(Condition=rep(c("ex1","ex2","ex3","ex4"),4),
Cluster=c(rep(1,4),rep(2,4),rep(3,4),rep(4,4)),
Percent=c(0,0,0,1,0.25,0,0.25,0.5,1,0,0,0,0.25,0.25,0.25,0.25))
ggplot(ex, aes(Cluster, Condition, size=Percent))+
geom_point(color = "blue")+ scale_size_area(max_size=20)
E.g. 'size = ifelse(Percent == 0,NA,Percent))'而不是'size = Percent'? – lukeA
它可能与'stroke'(点的轮廓)有关。虽然我的印象是,只有21点到25点有一个轮廓,当'百分号'为0时,在'geom_point'中使用'stroke = 0'将删除点。 – aosmith
@lukeA工作!如果您想将其作为答案发布,我很乐意接受它。 – dd3