[R] Plotting extra lines on scatterplot
Tony Laidig
c64 at MIT.EDU
Fri May 1 22:13:36 CEST 2009
Hello Everyone-
I'm in the process of slowly learning R and am having a little bit of
trouble plotting an extra line onto a scatterplot. I'm sure the answer
is quite simple but I am stumped.
The code I am using is:
headways <- read.table("headways.csv", header=TRUE, sep=",",
na.strings="", dec=".", strip.white=TRUE)
plot.new()
scatterplot(dechway~dechr, reg.line=FALSE, smooth=TRUE, labels=F,
boxplots='y', span=0.5, xlab="Time", ylab="Headway", ylim=c(0,9),
data=headways)
lines(headways$dechr, headways$schedule)
A subset of the dataset I'm working with is at
http://web.mit.edu/c64/www/headways.csv .
The extra line, plotted with lines(), should be right at 4, but is
actually below where it should be. I assume that I'm using the wrong
function to plot this line, as there are many ways to do it, but have
not the experience to know which function is appropriate to use with
scatterplot().
Thank you for all of your help.
-Tony
More information about the R-help
mailing list