Re: [R-sig-Geo] Change range of values of the legend
Thank you. You are right! (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 Da: Ben Tupper [btup...@bigelow.org] Inviato: venerd� 9 febbraio 2018 16.01 A: Stefano Sofia Cc: r-sig-geo@r-project.org Oggetto: Re: [R-sig-Geo] Change range of values of the legend 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<mailto: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<mailto: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<mailto: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<https://urlsand.esvalabs.com/?u=http%3A%2F%2Fwww.bigelow.org=52342f8a=e098bd83=y=y> Ecocast Reports: http://seascapemodeling.org/ecocast.html<https://urlsand.esvalabs.com/?u=http%3A%2F%2Fseascapemodeling.org%2Fecocast.html=52342f8a=a906bb68=y=y> Tick Reports: https://report.bigelow.org/tick/<https://urlsand.esvalabs.com/?u=https%3A%2F%2Freport.bigelow.org%2Ftick%2F=52342f8a=1216cd50=y=y> Jellyfish Reports: https://jellyfish.bigelow.org/jellyfish/<https://urlsand.esvalabs.com/?u=https%3A%2F%2Fjellyfish.bigelow.org%2Fjellyfish%2F=52342f8a=6c055c4c=y=y> -- This message has been checked by Libra Esva and is found to be clean. Mark it as spam<http://libraesvan2.regionemarche.intra/cgi-bin/learn-msg.cgi?id=D2C0A43AAE.A432F> Blacklist sender<http://libraesvan2.regionemarche.intra/cgi-bin/learn-msg.cgi?blacklist=1=D2C0A43AAE.A432F> 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 prop
Re: [R-sig-Geo] Change range of values of the legend
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> 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
[R-sig-Geo] Change range of values of the legend
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