2

我在 R 中使用 ggridges 来可视化我的数据。但是很多行是重叠的,很难阅读。

在此处输入图像描述

我的代码是:

ggplot(task1, aes(x = ibu, y = style, fill = style)) +
  geom_density_ridges(alpha=1) +
  theme_ridges() + 
  theme(legend.position = "none")

我应该改变什么以使这个可视化更具可读性?

4

1 回答 1

2

您可以使用该scale参数来调整整体高度缩放。只需将其设置为产生您喜欢的结果的数字即可。

library(ggplot2)
library(ggridges)
#> 
#> Attaching package: 'ggridges'
#> The following object is masked from 'package:ggplot2':
#> 
#>     scale_discrete_manual

ggplot(iris, aes(x = Sepal.Length, y = Species, fill = Species)) +
  geom_density_ridges()
#> Picking joint bandwidth of 0.181

ggplot(iris, aes(x = Sepal.Length, y = Species, fill = Species)) +
  geom_density_ridges(scale = 0.5)
#> Picking joint bandwidth of 0.181

reprex 包(v0.3.0)于 2019-11-03 创建

于 2019-11-03T18:17:57.233 回答