I have a data.frame with multiple time series vectors against a date:time vector. I would like to plot all of the relevant vectors, vertically stacked on separate graphs wit
I agree with @PaulHiemstra, ggplot2 is the way to go.
Assuming Smooth.Vert.Speed is the common x-axis variable against which you want to plot DEPTH, X, Y and Z...
library(ggplot2)
library(reshape2)
# Add time variable as per @BenBolker's suggestion
dt$time <- seq(nrow(dt))
# Use melt to reshape data so values and variables are in separate columns
dt.df <- melt(dt, measure.vars = c("DEPTH", "X", "Y", "Z"))
ggplot(dt.df, aes(x = time, y = value)) +
geom_line(aes(color = variable)) +
facet_grid(variable ~ ., scales = "free_y") +
# Suppress the legend since color isn't actually providing any information
opts(legend.position = "none")
