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
1
vote
1 answer

Add points to geom_density_ridges for groups with small number of observations

I am loving using geom_density_ridges(), with individual points also included for each group. However, some groups have small sample sizes (e.g. n=1 or 2) precluding the generation of the density ridges. For these groups, I'd like to be able to plot…
1
vote
1 answer

ggridges not showing all factors in legend

I'm trying to create a RidgePlot of this data: long_data <- structure(list(Cell_Type = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 10L,…
Beeba
  • 642
  • 1
  • 7
  • 18
1
vote
2 answers

How to label the count of each bin within ggridges package?

I have a data frame that simulates the NFL season with 2 columns: team and rank. I am trying to use ggridges to make a distribution plot of the frequency of each team at each rank from 1-10. I can get the plot working, but I'd like to display the…
D. Bryant
  • 105
  • 2
  • 8
1
vote
2 answers

ggridges - lower the first dataline to bottom of plot

I have a question regarding ggplot2 and ggridges. I want to plot same experimental XRD data. How am I able to lower the first data to the bottom of the plot without affecting the third plot (see picture). Here is the data # Data…
1
vote
1 answer

Weight ggridges by another variable

I'm trying to visualize some data with a ridge plot, but I'm wondering if there's a way I can weight the densities of the ridges. Basically I have the following: set.seed(1) example <- data.frame(matrix(nrow=100,ncol=3)) colnames(example) <-…
Jake L
  • 987
  • 9
  • 21
1
vote
0 answers

R / ggplot2: Add directlabels to ridgeline plot

I'm trying to add directlabels to lines of a ridgeline plot created by ggridges. It seems directlabels doesn't know what to apply the labels to. Is it possible to specify this? Or are the two packages incompatible? # does not…
Timm S.
  • 5,135
  • 6
  • 24
  • 38
1
vote
0 answers

How to fill colour in each individual density curve within a ridgeline plot

I want to specify the colour for each density in a ridgeline plot in R. I am using ggplot2 and ggridges. I have tried the following here to produce a ridge plot, with no colours: seq_plot_alt <- ggplot(seq_df, aes(x=x, y=as.factor(beta), fill =…
user-2147482565
  • 453
  • 7
  • 16
1
vote
0 answers

Adding labels to this ggridge plot

I can't see, to figure out how to add labels to this plot: ggplot(input_cleaned, aes(x =DAYS_TO_FA, y = fct_rev(DATE_TEXT), group = fct_rev(DATE_TEXT))) + geom_density_ridges2(stat="binline", bins = 75, scale = 0.95, draw_baseline = FALSE) + …
traggatmot
  • 1,423
  • 5
  • 26
  • 51
1
vote
2 answers

R: Tidy Aggregation of Sequence Data and Visualization of Stepfunctions

I have some patient data, where the individual patients change treatment groups over time. My goal is to visualize the sequence of group changes and aggregate this data into a "sequence profile" for each treatment group. For each treatment group I…
stats-hb
  • 958
  • 13
  • 31
1
vote
2 answers

How to connect bar plot, just like geom_density_ridges does for histogram

I am in trouble of creating plots in R. If I have data like I want to create: with x-axis be Sepal.length, Sepal.Width, Petal.Width, Petal.Length ,y-axis be different species and height be the values. And also fill each bar plot with different…
Cecily Mag
  • 45
  • 6
1
vote
2 answers

How shade area under ggridges histogram (stat = binline)?

Using Dr. Evers suggestion to shade areas under a density curve with ggridges works well. However, I find density curves can be deceiving in that they imply data is there when it's not. Thus, I thought I'd try this shading technique with an ordinary…
ixodid
  • 2,180
  • 1
  • 19
  • 46
1
vote
3 answers

How shade area under ggridges curve?

I would like to highlight in red all temperatures above 20 degrees in multiple plots created by ggridges library(tidyverse) library(ggridges) ggplot(t2, aes(x = t, y = year)) + stat_density_ridges(geom = "density_ridges_gradient", quantile_lines…
ixodid
  • 2,180
  • 1
  • 19
  • 46
1
vote
2 answers

Plotting ggridges point shapes / colors by variable?

There probably is an obvious solution to this, but I'm a bit naive with plotting. I'd like to have point_shape and point_fill defined manually to indicate e.g. gender groups. How would I go about doing this? In other words, I'd like to see e.g.…
1
vote
0 answers

ggplot2 , ggridges , Error in -x : invalid argument to unary operator

I'm trying to plot a joyplot graph( density distributions across time) from the ggridges package. The file 'Dados empilhados' is a pooled data set. library(ggridges) library(ggplot2) library(XLConnect) data = loadWorkbook('Dados…
1
vote
1 answer

GGRidges: single density plot too high

I have a data frame which is made of one single dependent variable and multiple independent variables. Groups of relationships were taken from different tests (but this is not important to solve the problem that I met). I'm using the package…
Michael Matta
  • 394
  • 2
  • 16