Closed mir-cat closed 6 years ago
Yes, this is correct. The documentation is wrong. In general in ggplot2, for objects that have fill and color, alpha is only applied to fill. It's the same behavior as in geom_density()
, for example.
If you absolutely want transparency on the lines, you can manually set a color that has the transparency you want:
ggplot(diamonds, aes(x = price, y = cut)) +
# manually set color to black with 0.1 alpha (hex #0000001A)
geom_density_ridges(scale = 2, alpha = 0.1, color = "#0000001A") + theme_ridges() +
scale_y_discrete(expand = c(0.01, 0)) + # will generally have to set the `expand` option
scale_x_continuous(expand = c(0, 0))
Not sure how useful that is, though.
You can also use colors with transparency in scale_color_manual()
if you want multiple different colors all with transparency.
Thanks! This solves my issue.
Reopening issue to flag that documentation needs to be fixed.
Using the example from the README:
In the help it says that alpha controls 'Transparency level of color and fill'. Right now it only seems to cover fill, as the outline remains unchanged with alpha.
Using
ggridges
version 0.4.1 on OSX