我正在尝试为具有一个因变量和三个因素(CHANGE_TYPE、IA_TYPE、PRESENTATION)的数据库创建小提琴图。我可以使用以下方法创建一个带有 4 把小提琴的小提琴图:
p <- ggplot(data, aes(factor(CHANGE_TYPE), mean_reading_rate))
p <- p + geom_violin(aes(fill = IA_TYPE))
产生以下内容:
然而,这遗漏了一个因素。我想要做的是水平合并两个这样的图,以便它们共享一个更宽的 X 轴,显示因子 PRESENTATION 的值(我怀疑它目前只是被平均了)。
知道如何实现吗?
编辑:抱歉不包括数据。它看起来像这样。
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 和 IA_TYPE 是具有两个级别的因子。