I am still learning ggplot
, and I'm getting hung up on geom_boxplot
. I'm graphing x vs y (both are continuous), and I would like to group it based on a 3rd column (let's call it "z"). However, when I try to graph it as such, I get an unexpected result:
ggplot()+
geom_boxplot(data=df,aes(x=x,y=y,group=z))
The graph looks like this:
This seems to group all datapoints, regardless of their X value, into a single box for the group Z. However, I'd like to create boxplots for each X value in each group in Z.
How would I go about doing this?