Reputation: 263
So I have a dataframe, that goes like:
time,candidate_id,allocation_id,final_score,position
data
...
Then I'm trying to make a ggplot2 boxplot. I want this boxplot to have a different box for each allocation_id
. I tried to make one with:
ggplot(data=(allocation_info), aes(allocation_id, final_score))
but instead of getting multiple boxplots for each allocation_id
, I just get a single giant boxplot. Anybody know why this might be happening?
Upvotes: 1
Views: 340
Reputation: 60452
You need to include the group or colour aesthetic:
data(mpg)
ggplot(data=mpg) + geom_boxplot(aes(x=cyl, y=displ, group=cyl))
So for your specific dataset it will be something like:
ggplot(data=(allocation_info), aes(allocation_id, final_score)) +
geom_boxplot(aes(group=allocation_id))
Upvotes: 4