简体   繁体   中英

ggplot2: about the size legend

ggplot(college, mapping = aes(x = tuition,
                              y = sat_avg,
                              size = undergrads,
                              color = control)) + 
geom_point(alpha = 1/2) + 
geom_smooth(se = FALSE) 

Hi all, after typing the code above, I found the legend of the size (undergrads) seems strange. They are supposed to be round ones instead of the overlapping shape. Anyone knows what's going wrong? Thanks.

在此处输入图片说明

I used the iris dataset to test this as I don't know where college is from, but it should work. You just need to add show.legend = F

ggplot(college, mapping = aes(x = tuition,
                              y = sat_avg,
                              size = undergrads,
                              color = control)) + 
geom_point(alpha = 1/2) + 
geom_smooth(se = FALSE, show.legend = F) 

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