See ?legend . you can add a legend directly to an existing plot. An example:
legend('topright',c('hot','cold'),lty=1,col=c('red','green'),bg='white') Now if you're trying to place the legend outside the plot area (i.e. in some other part of the window), you'll need to invoke par(xpd=TRUE) . See the help at ?par . Filoche wrote > Hi all. > I'm ploting a raster and I can't find the proper way to move the legend. > For example, > r = raster(system.file("external/test.grd", package="raster"))plot(r) > How can I put the legend at the desired position? > Thank in advance,Phil > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@ > 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. -- View this message in context: http://r.789695.n4.nabble.com/legend-position-tp4681489p4681492.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.