

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]]

