當我使用geom_density_ridges()最頂部的繪圖進行繪圖時,它會接觸面板的頂部。出于審美目的,我如何在那里創建一個小的空白空間?
library(ggplot2)
library(ggridges)
ggplot(iris, aes(x = Sepal.Length, y = Species))
geom_density_ridges()

uj5u.com熱心網友回復:
這可以通過以下expand引數增加 y 尺度的擴展來實作scale_y_discrete:
library(ggplot2)
library(ggridges)
ggplot(iris, aes(x = Sepal.Length, y = Species))
geom_density_ridges()
scale_y_discrete(expand = expansion(add = c(.3, 1.4)))
#> Picking joint bandwidth of 0.181

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/350046.html
上一篇:帶有facet_grid的多行x軸標簽,其中每個方面都有唯一的標簽
下一篇:R:按條件和平均圖疊加密度圖
