在ggplot2中定义最小点大小 - geom_point [英] defining minimum point size in ggplot2 - geom_point
问题描述
假设我的值大概在0,1和10左右。我已经映射了它们,即:
geom_point(aes(size = value))
..给我一张这样的图片:
很难看到很小的一点。所以我想知道是否可以设置点大小的缩放框架。 With:
scale_size_area(max_size = 8)
我可以设置最大尺寸但不是最小尺寸。我可以记录我的数据,导致几乎没有点大小差异。定义一个最小尺寸和一个最大尺寸可以省去指定的分布(比如可以使用scale_colour_gradient)。
如果你看看?scale_size
,你会看到 range
参数:
df < - data.frame(x = 1:10,y = runif(10),sz = c(rep(1,8),10, 10))
ggplot(df,aes(x = x,y = y,size = sz))+
geom_point()+
scale_size_continuous(range = c(2 ,4))
Let's say I have a lot of values around 0,1 and a few around 10. I have mapped them i.e., with:
geom_point(aes(size=value))
..which gives me an image like this:
It is hard to see the very small points. So I was wondering if I could set the scaling frame for the dot sizes. With:
scale_size_area(max_size=8)
I can set the max size but not a min size. I could log10 my data resulting in almost no point size difference. It would be perfect to define a minimum size and a maximum leaving out a specified distribution (like it is possible with scale_colour_gradient for example).
If you look in ?scale_size
you'll see range
argument:
df <- data.frame(x = 1:10,y = runif(10),sz = c(rep(1,8),10,10))
ggplot(df,aes(x = x,y = y,size = sz)) +
geom_point() +
scale_size_continuous(range = c(2,4))
这篇关于在ggplot2中定义最小点大小 - geom_point的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!