I have a series of lists describing duration (in days) of events, and I would like to plot this data as lines to compare the lists.
Below is some example data on what lunch options were served on which days at school. I have already parsed my data and this is the reduced form. Originally it was in the form of complex character strings.
soup = c(15:18)
grilledcheese = c(0:19)
pasta = c(3:13)
I want to create a graph similar to this one, with days on the x axis and soup
, grilled cheese
, and pasta
on the y axis:
I looked online and I'm not sure what kind of graph to use for this. Part of the difficulty is that the data does not start at 0 and the y axis should represent factors.
What I tried:
I tried plotting this in ggplot but it only takes data frames. I am wondering if there is a way to plot directly from lists. It seems like there should be a straightforward solution here that maybe I am missing.
I also tried this
plot(x = grilledcheese, y = rep(1, length(grilledcheese)))
which is closer to what I want, but I'm not sure how to plot multiple factors on the y axis.