增加 ggplot geom_point 中的最小点大小

rns*_*nso 3 r ggplot2

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

> 
> 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))
> 
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

这里较小的点尺寸确实非常小,几乎看不到。如果它是彩色的,它会变得更加模糊。是否可以增加较小的点大小以使其清晰可见?

Jaa*_*aap 5

您必须像这样使用range内部参数scale_size_discrete,例如:

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

这给出了以下结果: 在此处输入图片说明