-1

How to change the line color or shape in a ggridge density plot?

ggplot(iris, aes(x = Sepal.Length, y = Species)) +
  geom_density_ridges2() +
  scale_y_discrete(expand = c(0.01, 0)) +
  scale_x_continuous(expand = c(0.01, 0)) +
  theme_ridges()

enter image description here

Jellz
  • 435
  • 1
  • 7
  • 14

1 Answers1

1

I am not sure what you exactly want, but change the color of your lines can be done by using color in your geom_density_ridges2 function like this:

library(tidyverse)
library(ggridges)
ggplot(iris, aes(x = Sepal.Length, y = Species)) +
  geom_density_ridges2(color = "red") +
  scale_y_discrete(expand = c(0.01, 0)) +
  scale_x_continuous(expand = c(0.01, 0)) +
  theme_ridges()

Output:

enter image description here

As you can see, the color of the lines is changed to red.

Quinten
  • 35,235
  • 5
  • 20
  • 53