I am trying to create a violin plot for a database with one dependent variable and three factors (CHANGE_TYPE, IA_TYPE, PRESENTATION). I can create a violin plot with 4 violins using:
p <- ggplot(data, aes(factor(CHANGE_TYPE), mean_reading_rate))
p <- p + geom_violin(aes(fill = IA_TYPE))
which produces the following:
However, that leaves out one factor. What I would like to do is merge two such plots horizontally so that they share a further, wider X axis showing the values of the factor PRESENTATION (which is currently just being averaged across, I suspect).
Any idea how I might achieve that?
EDIT: Apologies for not including the data. It looks something like this.
Participant CHANGE_TYPE PRESENTATION IA_TYPE mean_reading_rate stdev_reading_rate
1 Accidental 1 non_target 80.73478 83.58174
1 Accidental 1 target 50.50102 32.69693
1 Accidental 2 non_target 73.10850 78.39836
1 Accidental 2 target 54.38447 45.92599
1 Substantive 1 non_target 68.96310 64.04057
1 Substantive 1 target 63.66268 25.35560
1 Substantive 2 non_target 60.08031 71.11967
1 Substantive 2 target 66.63825 59.14888
2 Accidental 1 non_target 56.52367 61.98396
2 Accidental 1 target 44.49227 40.71171
2 Accidental 2 non_target 68.21995 79.33617
2 Accidental 2 target 47.27487 28.70954
2 Substantive 1 non_target 53.29330 65.13060
2 Substantive 1 target 33.96295 21.49306
2 Substantive 2 non_target 51.28319 62.61050
2 Substantive 2 target 59.85926 63.77074
3 Accidental 1 non_target 56.25112 64.13430
3 Accidental 1 target 34.22665 18.58870
3 Accidental 2 non_target 47.78169 64.05134
3 Accidental 2 target 45.62304 79.84651
3 Substantive 1 non_target 54.82215 69.43809
3 Substantive 1 target 39.66745 22.40827
3 Substantive 2 non_target 40.58735 61.09965
3 Substantive 2 target 73.39946 80.98760
CHANGE_TYPE, PRESENTATION, and IA_TYPE are factors with two levels each.