Questions tagged [ggridges]

The ggridges R package is an add-on package to ggplot2. It provides geoms, stats, themes, and scales useful for the creation of ridgeline plots.

Resources:

  1. Introduction to ggridges
  2. github project
102 questions
19
votes
6 answers

geom_density_ridges requires the following missing aesthetics: y

No matter what I try I cannot create a ridgeline plot using ggridges. Using a dataframe graphing_dataframe that looks as follows: str(graphing_dataframe) summary(graphing_dataframe) > str(graphing_dataframe) Classes ‘tbl_df’, ‘tbl’ and…
Frank B.
  • 1,813
  • 5
  • 24
  • 44
15
votes
1 answer

Why does ggplot not allow suppressing of messages generated by its geoms?

The geom_density_ridges geom from the ggridges package created ridgelines, and if a bandwidth is not specified, it attempts to find a sensible value. It then uses the base R message function to report that value (see…
Matherion
  • 657
  • 1
  • 5
  • 13
14
votes
1 answer

R ggrides package drawing mean line (NOT MEDIAN)

I'd like to draw a line through my rideplots for the mean. The built-in quantile arguments draw a line in the style I want, but at the median. How can I draw one at the mean, preferably without using geom_vline() or pluck at the ggplot build object…
Laserhedvig
  • 381
  • 2
  • 13
13
votes
2 answers

Stop geom_density_ridges from showing non-existent tail values

When I use geom_density_ridges(), the plot often ends up showing long tails of values that don't exist in the data. Here's an example: library(tidyverse) library(ggridges) data("lincoln_weather") # Remove all negative values for "Minimum…
John J.
  • 1,450
  • 1
  • 13
  • 28
13
votes
1 answer

ggjoy facet with ggtree

Is it possible to add a joyplot as a panel to a plot that includes a ggtree, as shown in these examples? Examples of joyplots are here. I realize that I could manually put the species labels for the joyplot in the same order as the tree tip labels,…
LCM
  • 292
  • 4
  • 14
11
votes
3 answers

Add color gradient to ridgelines according to height

I want to color my ridgeline plot with gradient fill colors depending on the height of the area instead of depending on the X axis. It would be somthing like this: library(ggplot2) library(ggridges) ggplot(lincoln_weather, aes(x = `Mean…
mfalco
  • 428
  • 3
  • 14
11
votes
1 answer

How can I add a vertical colour gradient to a ridgeplot in ggridges?

The ggridges package lets you draw ridgeplots with either solid colour: ggplot(iris, aes(x=Sepal.Width, y=Species))+ geom_density_ridges(alpha=0.33, scale=2, fill="#0570b0", colour=alpha(0.1))+ theme_classic() or with horizontal colour…
7
votes
1 answer

How to adjust bandwidth for ridgeplots in R

When using the geom_density_ridges function in the ggridges package, it always picks a bandwidth for all the densities in the plot. But is there a way to adjust the bandwidth that it chooses? I currently have some code to make a ridge plot, but the…
user-2147482565
  • 453
  • 7
  • 16
6
votes
1 answer

image as axis tick ggplot

I've been searching around for a way to use png images as axis ticks in ggplot2, more precisely in ggridges I've read and tried to replicate answers to these posts, but packages have changed a lot in syntax from the time when they were posted to the…
Elio Diaz
  • 566
  • 2
  • 19
6
votes
1 answer

ggplot reverse axis order for factors

This is the base plot, with months ordered bottom-to-top one through twelve. I want to order them top-to-bottom one through twelve. library(tidyverse) library(nycflights13) library(ggridges) ggplot(weather %>% filter(temp > 50), aes(x = temp, y =…
stackinator
  • 5,429
  • 8
  • 43
  • 84
6
votes
2 answers

Line at the top of a ridgeline density plot is cut off

Why is the top of the plot cut off and how do I fix this? I've increased the margins and it made no difference. See the curve for year 1854, at the very top of the left hump. It appears the line is thinner at the top of the hump. For me, changing…
ixodid
  • 2,180
  • 1
  • 19
  • 46
6
votes
1 answer

Add custom vertical line joyplots ggridges

I would like to add a vertical line by row to joy plots using ggridges. # toy example ggplot(iris, aes(x=Sepal.Length, y=Species, fill=..x..)) + geom_density_ridges_gradient(jittered_points = FALSE, quantile_lines = FALSE, quantiles = 2, scale=0.9,…
sdaza
  • 1,032
  • 13
  • 29
5
votes
1 answer

Adding a mean to geom_density_ridges

I am trying to add means using geom_segment to a geom_density_ridges plot made in ggplot2. library(dplyr) library(ggplot2) library(ggridges) Fig1 <- ggplot(Figure3Data, aes(x = `hairchange`, y = `EffortGroup`)) + …
jbearazesh
  • 101
  • 1
  • 6
4
votes
1 answer

Adding geom_point to ggridges

If I want to add a point estimate to a ggridge object, but I keep getting an error: library(ggplot2) library(ggridges) iris_med <- iris %>% group_by(Species) %>% summarise(Sepal.Length = median(Sepal.Length)) ggplot(iris, aes(x = Sepal.Length, y =…
Hanjo Odendaal
  • 1,395
  • 2
  • 13
  • 32
4
votes
2 answers

Cyclical Error using ggridges in R (joyplot)

I am currently working with the ggridges library, in order to make a 'joychart.' I wrote this: data3 %>% mutate(ftFct = fct_rev(as.factor(ft_newnum))) %>% ggplot(aes(y = ftFct)) + geom_density_ridges(aes(x = ft, fill = paste(ftFct, rep)), …
Oliver G
  • 1,021
  • 2
  • 9
  • 20
1
2 3 4 5 6 7