IOanna,
If you are trying to distinguish between the type=b and the type=o in
the legend, there does not appear to be a way to do this with the legend()
function in base. I found a similar question posted on stackoverflow, and
they suggested a work around for something similar (but not quite the same).
http://stackoverflow.com/questions/18233236/how-to-get-lines-of-type-b-in-a-legend
Here's an example, using your data.
X1-c(0,1,2,3,4)
Y1-c(0,1,2,3,4)
Y2-c(5,6,7,8,9)
Y3-c(32,33,34,35,36)
plot(X1,Y3,pch=20, ylim=range(Y1, Y2, Y3))
lines(X1,Y1,lty=1,type='o')
lines(X1,Y2,lty=1,type='o', pch=21, bg=white)
lines(X1,Y3,lty=2)
legend(center, c(Y3, Y2, Y1), lty=c(2, 1, 1), pch=c(20, 21, 1),
pt.bg=c(NULL, white, NULL))
Jean
On Wed, May 28, 2014 at 3:21 AM, IOANNA ii54...@msn.com wrote:
Hello all,
I want to plot the legend for the following two lines:
I have two lines:
X1-c(0,1,2,3,4)
Y1-c(0,1,2,3,4)
Y2-c(5,6,7,8,9)
Y3-(32,33,34,35,36)
plot(X1,Y3,pch=20)
lines(X1,Y1,lty=1,type='o')
lines(X1,Y2,lty=1,type='b')
lines(X1,Y3,lty=2)
Any ideas how?
Best
IOanna
[[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.
[[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.