[R-sig-Geo] Plotting median values globally

Vijay Lulla v|j@y|u||@ @end|ng |rom gm@||@com
Tue Oct 29 14:02:17 CET 2019


Did you try `levelplot(raster(RCP1pctCO2median, 61))`?

On Tue, Oct 29, 2019 at 12:17 AM rain1290--- via R-sig-Geo <
r-sig-geo using r-project.org> wrote:

> Hi there,
> I am trying to create a global plot with median precipitation values. What
> I would like to do is isolate the "median" values and plot those values on
> a global raster map. I already first created a raster stack, called
> "RCP1pctCO2median", which contains the median values to be plotted.
> However, what I would like to do is simply plot only those values at Year
> 61 for each grid cell. There are 138 layers, with each layer representing
> one year. The idea would be to plot only those values for Year/layer 61
> globally (i,e, for each grid cell), but I am unsure how to isolate that
> specific year/layer?
> "RCP1pctCO2median"  has the following attributes:
>
> class       : RasterStack
> dimensions  : 64, 128, 8192, 138  (nrow, ncol, ncell, nlayers)
> resolution  : 2.8125, 2.789327  (x, y)
> extent      : -181.4062, 178.5938, -89.25846, 89.25846  (xmin, xmax, ymin,
> ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
> names       :    layer.1,    layer.2,    layer.3,    layer.4,    layer.5,
>   layer.6,    layer.7,    layer.8,    layer.9,   layer.10,   layer.11,
>  layer.12,   layer.13,   layer.14,   layer.15, ...
> min values  : 0.42964514, 0.43375653, 0.51749371, 0.50838983, 0.45366730,
> 0.53099146, 0.49757186, 0.45697752, 0.41382199, 0.46082401, 0.45516687,
> 0.51857087, 0.41005131, 0.45956529, 0.47497867, ...
> max values  :   96.30350,  104.08584,   88.92751,   97.49373,   89.57201,
>  90.58570,   86.67651,   88.33519,   96.94720,  101.58247,   96.07792,
>  93.21948,   99.59785,   94.26218,   90.62138, ...
>
>
> And this is how I would like to create my global raster map. However, I am
> not sure how to plot only one value (i.e. the median value, which occurs at
> Year 61) for each grid cell. This is what I have so far, but all that this
> does is plot 138 mini plots, and I just want one plot showing the median
> values (i.e. Year 61):
>
>
> mapTheme<-rasterTheme(region=rev(brewer.pal(10,"Spectral")))
> cutpoints<-c(200,175,150,125,100,75,50,25,0)
> levelplot(RCP1pctCO2median,margin=F,at=cutpoints,cuts=11,pretty=TRUE,par.settings=mapTheme,
> main="Median values")
>
>
>
> Any help would be greatly appreciated!
> I look forward to your response!
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list