简体   繁体   中英

defining minimum point size in ggplot2 - geom_point

Let's say I have a lot of values around 0,1 and a few around 10. I have mapped them ie, 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))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM