简体   繁体   中英

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

在此输入图像描述

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?

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: 在此输入图像描述

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