提问人:Klara Har 提问时间:11/7/2023 最后编辑:r2evansKlara Har 更新时间:11/7/2023 访问量:44
小提琴图显示其他数据点
Violin Plot shows additional data points
问:
这是我的第一篇文章,所以我希望能提到希望得到答案所需的一切。
我的小提琴图显示的数据点比我用于它的数据框中给出的数据点多。
我创建了一个 R 脚本来显示我在小提琴图中与横断面圆形 (Transect_nr.y) 和蜜蜂蜂巢 (Hives) 相关的传粉媒介密度 (Sum_num) 的数据。剧情是这样的:
这是我为剧情创建的脚本:
ggplot(all_combinations, aes(x = PollinatorType, y = Sum_num, fill = PollinatorType)) +
geom_violin(trim = FALSE) +
geom_jitter(width = 0.2, alpha = 1.0, show.legend = FALSE) +
geom_boxplot(width=0.165, color="black", alpha=0.7) +
labs(x = "Pollinator Type", y = "Density of Pollinators per 150 m^2", fill = "Pollinator Type") +
ggtitle("Density of Honeybees and Wild Pollinators per Transect Round") +
facet_grid(Hives ~ factor(Transect_nr.y, levels=c('1','2','3','4'))) +
theme_minimal() +
theme(axis.text.x = element_blank(), # Remove x-axis labels
axis.title.x = element_blank(), # Remove x-axis title
legend.position = "bottom")
查看用于此图的数据框,我注意到图中显示了数据框中不存在的其他数据点。小提琴顶部所有较浅的黑点都是这种情况(例如,横断面第 2 轮,无蜂巢,蜜蜂 - > 点在 ~185)。 以下是数据框的摘录,您可以在其中看到,对于上述示例,实际上应该只有 7 个数据点,但图形显示 8 个。
为什么?我的小提琴剧情剧本有问题吗?
提前致谢! 克拉拉
答: 暂无答案
评论