简体   繁体   中英

How to subdivide a class in geom_points()

I'm trying to plot bird measures using species as class, but I'd also like to split species into males and females, as if they were two different plotting columns. When I use box_plot() 1 , it automatically does that, but I can't do the same with geom_points()

Let's suppose "birds" is my dataset, x=species , y=bill.length and color=sex

How to split species in two columns using the class sex?

I found a solution:

bird.plot<-ggplot(birds,aes(x=sex,y=bill.length,color=sex,alpha=.7))+geom_point()+facet_grid(~species)

result here

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