I am drawing two plots on the same graphics device window as follows:
yLim<-range(range(template),range(slope*subSeries) )
plot( template, type="p", pch=19,cex=1.75,lwd=2.5,lty=1, ann=F,
axes=F,frame.plot=T,col="red", ylim=yLim,new=T )
title( main = "myDotChart of original template and subSeries vs time" );points(
slope*subSeries, type="p", pch=15,cex=1.35,lty=2,lwd=2.5, col="blue", ann=F )
I want to connect the two corresponding points at the same x-coordinate (
x-axes is shared by both plots essentially). I want to connect the template
points to the subSeries points at each x-coordinate.
The x-axes is 1:30 in both plot and the points;
Here's an example for the 2 points trying to connect two points for the
x-coordinate = 3:
segments(3, template[3], 3,subSeries[3], col= "black",lwd=2)Now here's what I
get: a black line from the x-axis to the point: c(3, template[3])In other words
the above statement acts the same as: segments(3, template[3], 3, 0, col=
"black",lwd=2);I cannot make segments or lines that connect two points at the
same x-coordinate.I also tried this: segments(3.1, template[3],
2.9,subSeries[3], col= "black",lwd=2) whichstill drew a line starting at the
x-axes, ignoring the subSeries[3] point altogether.How can I generate line
segments between two sets of points on the same graph?Sincerely,Lloyd L
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.