how to subgroup a violin plot

Hi! I'm quite new to R and ggplot, hence the question. I have already computed a violin plot with the variables of interest (Emotion x Accuracy), however I want the plot to be divided by another variable (group) so that the result is somewhat similar to this (see image) but I have no idea how to.

What I have written is this:
data_wide <- GC[,4:6]
data_wide %>%
gather(key="Emotion", value="Accuracy", ) %>%
ggplot( aes(x=Emotion, y=Accuracy, fill=Emotion)) +

-then there are other scripts related to aesthetics which are not the main issue-.

Thank you in advance!

the chart shows a fill on Age not Emotion; so reconsider your code in light of that ?

Maybe I did not explain it correctly, the chart was only an example as the plot I wanted to achieve :slight_smile:

can you copy and paste the result of dput(head(yourdf,20)) so that I can work with your data

If you wan to to reproduce this plot in easy form, you need have the same data order. Check the data order in data_wide , check the columns, because if you have the same order columns should run well.

Thank you, I did find a way to reproduce it!

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.