Hi, Try
plot(rast, zlim = c(-5, 5)) I think the zlim argument is passed through to graphics::image() via fields::image.plot() which raster::plot() calls. I know it isn't super obvious until until you re-read the docs about 2000 times. Cheers, Ben > On Feb 9, 2018, at 9:39 AM, Stefano Sofia <stefano.so...@regione.marche.it> > wrote: > > Dear list users, > suppose that I have this simple raster: > > library(raster) > xy <- matrix(rnorm(400),20,20) > rast <- raster(xy) > > plot(rast) gives me a legend with range (-3,3). > I would like to change the range of the legend to (-5,5), for example. I > tried with > > plot(rast, legend=FALSE, axes=FALSE) > r.range <- c(-5, 5) > plot(rast, legend.only=TRUE, axis.args=list(at=seq(r.range[1], r.range[2], > 1), labels=seq(r.range[1], r.range[2], 1))) > > but this does not expand the values of the legend. > Could somebody give me some hints? > > Thank you > Stefano > > > (oo) > --oOO--( )--OOo---------------- > Stefano Sofia PhD > Area Meteorologica e Area nivologica - Centro Funzionale > Servizio Protezione Civile - Regione Marche > Via del Colle Ameno 5 > 60126 Torrette di Ancona, Ancona > Uff: 071 806 7743 > E-mail: stefano.so...@regione.marche.it > ---Oo---------oO---------------- > > ________________________________ > > AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere > informazioni confidenziali, pertanto è destinato solo a persone autorizzate > alla ricezione. I messaggi di posta elettronica per i client di Regione > Marche possono contenere informazioni confidenziali e con privilegi legali. > Se non si è il destinatario specificato, non leggere, copiare, inoltrare o > archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, > inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio > computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso > di necessità ed urgenza, la risposta al presente messaggio di posta > elettronica può essere visionata da persone estranee al destinatario. > IMPORTANT NOTICE: This e-mail message is intended to be received only by > persons entitled to receive the confidential information it may contain. > E-mail messages to clients of Regione Marche may contain information that is > confidential and legally privileged. Please do not read, copy, forward, or > store this message unless you are an intended recipient of it. If you have > received this message in error, please forward it to the sender and delete it > completely from your computer system. > > -- > This message was scanned by Libra ESVA and is believed to be clean. > > > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo Ben Tupper Bigelow Laboratory for Ocean Sciences 60 Bigelow Drive, P.O. Box 380 East Boothbay, Maine 04544 http://www.bigelow.org Ecocast Reports: http://seascapemodeling.org/ecocast.html Tick Reports: https://report.bigelow.org/tick/ Jellyfish Reports: https://jellyfish.bigelow.org/jellyfish/ [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo