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
2.2k views
in Technique[技术] by (71.8m points)

r - Increasing minimum point size in ggplot geom_point

I am using following data and code:

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

The smaller point size here is really very small and is hardly visible. It becomes even more obscure if it is colored. Can the smaller point size be increased so that it is clearly visible?

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

You will have to use the range parameter inside scale_size_discrete like this for example:

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

which gives the following result: enter image description here


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

...