[R-sig-Geo] rasterVis::streamplot with colorkey

Ben Tupper btupper at bigelow.org
Fri Dec 23 14:46:17 CET 2016


Hi,

Thanks so much for the tips!

Today the package author has kindly added a colorkey argument to streamplot function with a FALSE default value.  Setting it to TRUE draws the colorkey.  Woooohooo!

https://github.com/oscarperpinan/rastervis/commit/ea1c49e945616e8c7dc203069dbc2a1e2d91baf7

Cheers,
ben


> On Dec 23, 2016, at 7:36 AM, chris english <englishchristophera at gmail.com> wrote:
> 
> Ben,
> 
> Not so much hard wired (colorkey) but coming in a couple of times so which to use? As kind of explained here:
> http://stackoverflow.com/questions/34320868/map-with-panel-plots <http://stackoverflow.com/questions/34320868/map-with-panel-plots>,
> 
> and further, more directly on rasterVis from Augustin Lobo:
> http://rpubs.com/alobo/rasterVis_Intro1 <http://rpubs.com/alobo/rasterVis_Intro1>
> 
> which looks like it will get you to the results you want, though I haven't worked it through your example.
> HTH,
> Chris
> 
> 
> 
> On Wed, Dec 21, 2016 at 11:14 AM, Ben Tupper <btupper at bigelow.org <mailto:btupper at bigelow.org>> wrote:
> Hello,
> 
> We have wind data that we would like to draw with rasterVis::streamplot(). We would like to include a colorkey to associate with the region but it seems that deep down rasterVis::streamplot has hardwired `colorkey = FALSE`  I'm not sure how to circumvent this to allow for a color key. So, in brief...
> 
> How do I draw a streamplot with a colorkey?
> 
> Below is my example and sessionInfo() output.
> 
> Thanks so much,
> Ben
> 
> ### begin example
> library(raster)
> library(rasterVis)
> library(RColorBrewer)
> 
> V = volcano/10
> V = V - mean(V)
> U = V[nrow(V):1,]
> 
> V = raster::raster(V)
> U = raster::raster(U)
> S = raster::stack(U,V)
> 
> rasterVis::streamplot(S,
>     isField = 'dXY',
>     par.settings = rasterVis::streamTheme(
>         region = rev(RColorBrewer::brewer.pal(n=4, name= 'Greys')),
>         symbol = hexbin::BTC(n=9,beg=20)),
>     droplet = list(pc = 1),
>     scales = list(draw = TRUE),
>     colorkey = TRUE)
> 
> # Error in .local(x, data, ...) :
> #  formal argument "colorkey" matched by multiple actual arguments
> 
> ### end example
> 
> 
> > sessionInfo()
> R version 3.3.1 (2016-06-21)
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> Running under: OS X 10.11.6 (El Capitan)
> 
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> 
> other attached packages:
> [1] rasterVis_0.40      latticeExtra_0.6-28 RColorBrewer_1.1-2  lattice_0.20-33     raster_2.5-8        sp_1.2-3
> 
> loaded via a namespace (and not attached):
> [1] zoo_1.7-13        parallel_3.3.1    hexbin_1.27.1     Rcpp_0.12.6       grid_3.3.1        viridisLite_0.1.3
> 
> 
> 
> 
> 
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org <http://www.bigelow.org/>
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org <mailto:R-sig-Geo at r-project.org>
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo <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




	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list