An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20101013/2546758b/attachment.pl>
legend does not appear in all cases in a plot?
2 messages · govindas at msu.edu, Edzer Pebesma
The x and y ranges of your plot depend on your data, but the (first) legend command hard codes coordinate values (-2, 0.5). These coordinate values may not be near enough to you data values to see it.
On 10/14/2010 03:36 AM, govindas at msu.edu wrote:
Hello all,
Here I am with a plot issue - when I try to add legend it does not work at all times. Can someone tell me what's wrong with my code?
the following legend does not work!
plot(ts(tot_avg1[,1], freq=12, start=c(1981,12), end=c(2009,12)), ylim=c(min(tot_avg1[,1]), max(tot_avg1[,3])),
xlab="Time", ylab="SST (deg Celcius)", lty=2, col=2) #red
lines(ts(tot_avg1[,2], freq=12, start=c(1981,12), end=c(2009,12))) #black
lines(ts(tot_avg1[,3], freq=12, start=c(1981,12), end=c(2009,12)), lty=3, col=4) #blue
legend(-2, 0.5, c("Min", "Mean", "Max"), col=c(2,1,4), lty=c(2,1,3))
but, if i specify the position in words, like the one given below, it works!
legend("topright", c("Min", "Mean", "Max"), col=c(2,1,4), lty=c(2,1,3))
is there something i am missing here?
Thanks,
Mahalakshmi
[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Edzer Pebesma Institute for Geoinformatics (ifgi), University of M?nster Weseler Stra?e 253, 48151 M?nster, Germany. Phone: +49 251 8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de http://www.52north.org/geostatistics e.pebesma at wwu.de