[英]R Violin plots and boxplots together, make fill behave differently only for boxplots
[英]Boxplots within violin plot with faceting and fill R
我正在嘗試在每個小提琴圖中創建帶有箱線圖的小提琴圖。 目前,箱線圖是基於 x 變量創建的,同時結合了填充分組。 我希望每個 x 變量處的每個填充組都有一個箱線圖。
謝謝您的幫助!
ggplot(aes(y = HGT.Diff,
x = `Platform`,
fill = Metric,
color = Metric),
data = dta_compile) +
geom_violin(draw_quantiles = c(0.5)) +
geom_boxplot(width = 0.1, fill = "grey", color = "black") +
ylim(0,1) +
labs(title = "Comparing Ground Filters",
x = "Flight Date",
y = "Absolute Difference to Manual HGT Measurmenets (m)") +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust=.4)) +
facet_grid(`Flight.Date` ~ `GroundFilter`)
通過在小提琴和箱線圖中加入閃避設置,獲得了預期的結果。 感謝您的幫助!
ggplot(aes(y = HGT.Diff,
x = `Platform`,
fill = Metric,color=Metric),
data = dta_compile) +
geom_violin(position=position_dodge(),draw_quantiles=c(0.5)) +
geom_boxplot(width=0.1,color="black",position = position_dodge(width =0.9))+
ylim(0,1) +
labs(title="Comparing Ground Filters",
x="Flight Date",
y="Absolute Difference to Manual HGT Measurmenets (m)") +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust=.4)) +
facet_grid(`Flight.Date`~`GroundFilter`)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.