Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
675 views
in Technique[技术] by (71.8m points)

r - 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 i.e., with:

geom_point(aes(size=value))

..which gives me an image like this: enter image description here

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...