我能够使用ggridges建立水平密度脊线图,并通过以下代码进一步添加分位数线:
#Horizontal density ridges analysis
ggplot(delaware, aes(x = b1_b3, y = LLRange)) +
geom_density_ridges(rel_min_height = 0.01, quantile_lines = TRUE, quantiles = 2) +
theme_ridges(grid = FALSE)
水平密度脊图像:
然后我使用以下简单代码(geom_vridgeline
)将相同的分析转换为显示垂直脊:
ggplot(delaware,
aes(x = LLRange, y = b1_b3, width = ..density.., color = LLRange, fill = LLRange)) +
geom_vridgeline(stat = "ydensity", trim = FALSE, alpha = 0.5, scale = 1) +
theme_ridges(grid = FALSE) +
scale_y_continuous(limits = c(0.5, 2))
将quantile_lines = TRUE, quantiles = 2
添加到geom_vridgeline
不起作用。我看到它不支持quantile_lines。如何绘制分位数线?