gpt4 book ai didi

r - 增加 ggplot geom_point 中的最小点大小

转载 作者:行者123 更新时间:2023-12-01 12:39:58 25 4
gpt4 key购买 nike

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

> 
> 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

这里的小点真的很小,几乎看不出来。如果它是彩色的,它会变得更加模糊。是否可以增加较小的点大小以使其清晰可见?

最佳答案

您必须在 scale_size_discrete 中使用 range 参数,例如:

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

结果如下: enter image description here

关于r - 增加 ggplot geom_point 中的最小点大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25809824/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com