You can just add the extra columns in with lines
which is like plot
but draws on the existing plot. (see ?lines
, ?points
).
Also, when you plot
with a data frame you can skip all the option$
by feeding option
into the dat
argument (see ?plot
):
# draw original plot
plot(mean ~ p.move, dat=option, xlim=c(0,1), type="o", ylim=c(0,20),
xlab="Probability",ylab="% time",col=1,lwd=1.85)
# draw extra lines (the '%' in the column names gets converted to '.' by R)
# note you can put your usual `plot` arguments into `lines` like lwd, type etc
# if you want
lines(upper95.CI ~ p.move, option)
lines(lower95.CI ~ p.move, option)