Hello everyone,
I'd like to create a plot of two timeseries, in the style of a ridgeplot (see image). So instead of plotting a density, I'd like to plot two timeseries in the same plot, but have them not overlap. The timeseries only take on values of 0 or 1.
I've been playing around in R using just geom_line(), but with no succes. The closest I've gotten is with the code below.
Any tips are much appreciated.
library(tidyverse)
df <- data.frame(
g1 = rbinom(n = 50, size = 1, prob = 0.60),
g2 = rbinom(n = 50, size = 1, prob = 0.60),
time = 1:50)
df %>%
pivot_longer(1:2) %>%
ggplot(mapping = aes(x = time, y = name, col = value)) +
geom_line()
Created on 2020-07-27 by the reprex package (v0.3.0)