【发布时间】:2015-11-06 20:37:49
【问题描述】:
我想使用带有箱线图的小提琴图绘制二维分布图。结果可能非常令人着迷,但前提是做得正确。
ToothGrowth$dose <- as.factor(ToothGrowth$dose)
head(ToothGrowth)
plot <- ggplot(ToothGrowth, aes(x=dose, y=len, fill=supp)) +
geom_violin() + geom_boxplot(width=0.1) + theme(legend.position="none")
ggsave(filename="Violinboxplot.png", plot, height=6, width=4)
这就是我得到的:
箱线图沿属于因子的轴对齐。如何将它们移动到小提琴图的中心?
【问题讨论】:
标签: r ggplot2 boxplot violin-plot