在ggplot的geom_point中增加最小点大小

3

我正在使用以下数据和代码:

> 
> dput(ddf)
structure(list(xx = c("aa", "bb", "cc"), gp = c("one", "two", 
"one"), yy = c(5L, 10L, 15L)), .Names = c("xx", "gp", "yy"), class = "data.frame", row.names = c(NA, 
-3L))
> 
> 
> ddf
  xx  gp yy
1 aa one  5
2 bb two 10
3 cc one 15
> 
> ggplot(ddf)+geom_point(aes(x=xx, y=yy, size=gp))
> 

enter image description here

这里的字号非常小,几乎看不清。如果它被着色,那么更加难以辨认。能否将字号增大,以便清晰可见?

1个回答

5
您需要在使用scale_size_discrete时,使用range参数,例如:

range参数的使用示例:

ggplot(ddf) +
  geom_point(aes(x=xx, y=yy, size=gp)) +
  scale_size_discrete(range=c(3,5))

which gives the following result: enter image description here


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接