Hello Everyone,

I have some data that like most real world data isn't complete.  I'm trying
to plot all of it together with lines connecting the data points.  Because
I have breaks in the data I have breaks in the lines.

Is there a way that the lines will connect all the markers???   Below is
the code.

Thanks in advance.
David

#Load your data.  The data is in a spreadsheet named KW-spreadsheet and we
are going to call it "data" in R
mydata <- read.csv("http://doylesdartden.com/example-smoothing-data.csv";,
sep=",")
attach(mydata)

#Plots the Y and X axis
plot( Date, dataset1,

 #sets the range of the y axis
ylim=range(5.7,8),

#sets the symbol type, size, and color for the 1st series
pch=10,cex=0.8, col='black', xlab="Date ", ylab="pH")

#Plots the second series
points( Date, dataset2, col='blue',pch=2, cex=0.8)

#Plots the 3rd series
points( Date, dataset3, col='red',pch=3, cex=0.8)

#Lines
lines(Date, dataset1, lty = c(1),col='black')
lines(Date, dataset2, lty = c(2),col='blue')
lines(Date, dataset3, lty = c(3),col='red')

#Add Legend to graph.  You can change the size of the box by changing cex =
0.75  Large # makes it larger.
legend("bottomleft",c("Dataset1","Dataset2", "Dataset3"),
col = c("black","blue", "red"),
cex = 0.7,text.col = "black",lty = c(1,2,3),lwd=c(2),pch = c(10,2,3),
merge = TRUE, bg = 'gray90')

#Add title
title(main="Time Series Plot")
#done

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to