[R-sig-Geo] rasterVis: Region colours do not match the legend colours
Oscar Perpiñán Lamigueiro
oscar.perpinan at gmail.com
Fri Jul 5 18:13:23 CEST 2013
Hello,
> However, I would still like to know how to manually set the region colours
> and extend the range of the legend, if it is possible.
You have to use the at argument as you already did. However, you should
choose better breaks to display your data correctly. Here you will find
an example: http://rastervis.r-forge.r-project.org/FAQ.html#sec-1.
> I am also dealing with a time component, so while stacking the layers
> forces all the layer plots to use the same colours at the same values
> at, say time t=0, the range of data may change after some time has
> progressed, say at time t=10.
>
> Ultimately, the goal would be to make a gif to compare several climate model
> forecasts over time, like so:
>
> <http://r-sig-geo.2731867.n2.nabble.com/file/n7584034/testing.gif>
>
> If the gif is viewable, notice how the legend is changing as the gif
> animation plays out - I want to, if possible, have the legend fixed and the
> regions coloured correctly according to the legend.
Use layout=c(1, 1). With your data:
levelplot(s, layout=c(1, 1))
If you need to create a movie use this code:
trellis.device(png, file='Rplot%02d.png')
levelplot(s, layout=c(1, 1))
dev.off()
## ffmpeg must be installed in your system
movieCMD <- 'ffmpeg -i Rplot%02d.png output.mp4'
system(movieCMD)
Take a look at this thread for more info:
https://stat.ethz.ch/pipermail/r-sig-geo/2013-July/018735.html.
Best,
Oscar.
> I have read the link about creating an independent legend for each raster
> layer, but I think I would prefer to have just one legend.
>
> Thanks again,
>
> Jonathan
>
>
>
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/rasterVis-Region-colours-do-not-match-the-legend-colours-tp7584032p7584034.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Oscar Perpiñán Lamigueiro
Grupo de Sistemas Fotovoltaicos (IES-UPM)
Dpto. Ingeniería Eléctrica (EUITI-UPM)
URL: http://procomun.wordpress.com
Twitter: @oscarperpinan
LinkedIn: http://www.linkedin.com/in/oscarperpinan
More information about the R-sig-Geo
mailing list