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 import
data_celestine <- read.table('../Data/celestine.asc')
data_barite <- read.table('../Data/barite.asc')
data_sample <- read.table('../Data/sample.asc')
# Plot
df <- data.frame(
x=data_celestine$V1,
y=c(data_sample$V2, data_celestine$V2, data_barite$V2),
samplename=c(rep('Sample', length(data_celestine$V1)), rep('Celestine',length(data_celestine$V1)), rep('Barite',length(data_celestine$V1))))
library(ggplot2)
library(ggridges)
p <- ggplot(df, aes(x,y, color=samplename))
p + geom_ridgeline(
aes(y=samplename, height=y),
fill=NA, scale=.00004, min_height=-Inf) +
theme_bw()
Thank you very much for helping me.
I found the answer. Adding the argument
add
toexpansion
did the job.