You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if it is possible to have a manually-defined gradient on the y-axis? So for example to have a starting (minimum) colour and ending (maximum) colour, in this case white and black respectively to make a really nice looking shaded plot.
This is for aesthetics mostly, but also aids the eye in finding peaks which reach the maximum. In this particular case the minimum and maximum are 0 and 1 although that shouldn't matter.
Thank you
The text was updated successfully, but these errors were encountered:
This feature could be implemented in principle now that grid supports gradients. But it's not high on my priority list. If somebody wants to take a stab I'm happy to consider a PR.
After #98 in an appropriate version of R and graphics device (i.e. ggplot2::check_device("gradients") is TRUE):
library(ggplot2)
library(ggridges)
gradient_fill=grid::linearGradient(c("white", "black"), x2=0, group=FALSE)
ggplot(diamonds, aes(x=price, y=cut)) +
geom_density_ridges(scale=4, fill=gradient_fill) +
scale_y_discrete(expand= c(0, 0)) +# will generally have to set the `expand` option
scale_x_continuous(expand= c(0, 0)) +# for both axes to remove unneeded padding
coord_cartesian(clip="off") +# to avoid clipping of the very top of the top ridgeline
theme_ridges()
Thank you very much!
I was pleasantly surprised to see this come to fruition. I can now fix my hacks and create these figures properly. I hope others benefit with this addition as well.
Hi, thanks for the package, it's great.
I was wondering if it is possible to have a manually-defined gradient on the y-axis? So for example to have a starting (minimum) colour and ending (maximum) colour, in this case white and black respectively to make a really nice looking shaded plot.
This is for aesthetics mostly, but also aids the eye in finding peaks which reach the maximum. In this particular case the minimum and maximum are 0 and 1 although that shouldn't matter.
Thank you
The text was updated successfully, but these errors were encountered: