2

I use ggridges in R to visualize my data. But a lot of the lines are overlapping and are hard to read.

enter image description here

My code is:

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

What should I change to make this visualization more readable?

Marcus Campbell
  • 2,746
  • 4
  • 22
  • 36
iilla
  • 105
  • 7

1 Answers1

2

You can use the scale parameter to adjust the overall height scaling. Just set it to a number that produces results you like.

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

Created on 2019-11-03 by the reprex package (v0.3.0)

Claus Wilke
  • 16,992
  • 7
  • 53
  • 104