Thank you David, it is exactly what I needed. Regards,Phil > From: dcarl...@tamu.edu > To: pmassico...@hotmail.com; r-help@r-project.org > Subject: RE: [R] legend position > Date: Mon, 2 Dec 2013 14:29:06 -0600 > > It is not straightforward unless you want the legend in the > right or the bottom margins. To put the legend inside the plot > region it is simplest to use image() to plot the raster file and > then image.plot(legend.only=TRUE) to add the legend. In addition > to reading the help page for plot{raster}, you also need the > pages for image{raster} and image.plot{fields}. Here are two > simple examples. > > image(r, col=rev(terrain.colors(255))) > plot(r, horizontal=TRUE, smallplot=c(.15, .5, .84, .86), > legend.only=TRUE) > > image(r, col=rev(terrain.colors(255))) > plot(r, smallplot=c(.15, .17, .5, .85), legend.only=TRUE) > > ------------------------------------- > David L Carlson > Department of Anthropology > Texas A&M University > College Station, TX 77840-4352 > > -----Original Message----- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of philippe > massicotte > Sent: Monday, December 2, 2013 1:22 PM > To: r-help@r-project.org > Subject: [R] legend position > > 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@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.