levelplot

Plotting a raster with exponential or quantile color ramp diverging around zero

做~自己de王妃 提交于 2019-12-24 14:07:54
问题 I am using the R function levelplot() from the rasterVis package to plot a stack of three rasters with a single diverging color ramp. I would like to change the scale of a raster color ramp so that the map accentuates differences in lower values. This can be done by non-linear binning of the color breaks. I'm using the code from a gist written by @jbaums (code included below). Any suggestions on how to adjust the color ramp in this code so that the breaks follow 2^x but the min and max values

R levelplot adjust axes

梦想与她 提交于 2019-12-22 12:21:11
问题 I want to plot the probability distribution function (PDF) as a heatmap in R using the levelplot function of the "lattice" package. I implemented PDF as a function and then generated the matrix for the levelplot using two vectors for the value ranges and the outer function. I want the axes to display the My issue is that am not able to add properly spaced tickmarks on the two axes displaying the two actual value ranges instead of the number of columns or rows, respectively. # PDF to plot

Add Different Labels to Secondary X-Axis of Levelplot in Lattice in R

淺唱寂寞╮ 提交于 2019-12-22 09:47:41
问题 I've managed to label the secondary X-axis in a levelplot using scale=list((alternating=3)) as solved by @KoenV here: How to Add Labels to Top X-Axis of Levelplot in Lattice Package Now this duplicates the primary X-axis labels onto the secondary X-axis as can be seen by running the code below. However, I need to add different labels to the secondary X-axis. Does anyone know how to do this? In the example below I would like to have 'hor' as the primary X-axis labels and 'hor2' as the

Levelplot color key - range and extremes

隐身守侯 提交于 2019-12-21 05:16:10
问题 Is it possible in R to create a color key like the one below? (this one comes from the software Grid Analysis and Display System - Grads). There are two features that I can't reproduce in R: The sequence is non linear however it is displayed as if Values bigger than 200 are grey / Values smaller than 0 are white I'm using levelplot from rastervis that plots rasters using the lattice levelplot: require(raster) require(rasterVis) set.seed(200) X = seq(-40,0,by=1) Y = seq(-60,-40,by=1) grid =

How do I specify different color ranges for different levels?

和自甴很熟 提交于 2019-12-20 19:47:15
问题 I am making a lattice levelplot from x and y factors that range from [0,1]: x y level 1 m3134 m3134 1.0000000 2 m3134 m416B 0.4189057 3 m416B m3134 0.2696508 4 m3134 mA20 0.3322170 5 mA20 m3134 0.2454191 6 m3134 mB 0.3176792 ... Here is the R script that I use to make the figure from this data: #!/foo/bar/bin/Rscript --vanilla args <- commandArgs(TRUE) mtxFn <- args[1] pdfFn <- args[2] mtx <- read.table(mtxFn, col.names=c("x", "y", "level")) mtx$level[(mtx$level == 1)] <- NA library(lattice)

Visualize negative/positive data using levelplot in R

假如想象 提交于 2019-12-20 05:05:06
问题 I need your insights on how to visualize/map data that span negative and positive values. I have 6 rasters which have been stacked together ( s ) and will subsequently be plotted via the levelplot function in R. Below are the max and min values for each raster . 39.2887, 53.09207 (min, max) # r1 -32.4956, -27.25534 (min, max)# r2 -14.37683, -11.37742 (min, max)# r3 9.512934, 13.60197 (min, max)# r4 -4.993901, -1.851784 (min, max)# r5 -8.190711, -5.104764 (min, max)# r6 At the moment, I am

Visualize negative/positive data using levelplot in R

允我心安 提交于 2019-12-20 05:04:35
问题 I need your insights on how to visualize/map data that span negative and positive values. I have 6 rasters which have been stacked together ( s ) and will subsequently be plotted via the levelplot function in R. Below are the max and min values for each raster . 39.2887, 53.09207 (min, max) # r1 -32.4956, -27.25534 (min, max)# r2 -14.37683, -11.37742 (min, max)# r3 9.512934, 13.60197 (min, max)# r4 -4.993901, -1.851784 (min, max)# r5 -8.190711, -5.104764 (min, max)# r6 At the moment, I am

Visualize negative/positive data using levelplot in R

喜夏-厌秋 提交于 2019-12-20 05:04:07
问题 I need your insights on how to visualize/map data that span negative and positive values. I have 6 rasters which have been stacked together ( s ) and will subsequently be plotted via the levelplot function in R. Below are the max and min values for each raster . 39.2887, 53.09207 (min, max) # r1 -32.4956, -27.25534 (min, max)# r2 -14.37683, -11.37742 (min, max)# r3 9.512934, 13.60197 (min, max)# r4 -4.993901, -1.851784 (min, max)# r5 -8.190711, -5.104764 (min, max)# r6 At the moment, I am

how to create vectorplot from velocity dataset?

♀尐吖头ヾ 提交于 2019-12-13 01:59:30
问题 Related to my previous question about calculate atan2 from two raster object in R?. It's possible to create a vector plot where the speed (slope) and direction (aspect) is displayed with a set of arrows (e.g. quiver in Matlab) based on this equation: for speed : ws <- sqrt(u^2+v^2) for direction : wd <- (180/pi)*(atan2(u,v)) my dataset sample can be downloaded here u <- raster(flname, varname = 'U') v <- raster(flname, varname = 'V') uv <- stack(u,v) I used rasterVis package to figure the

Adding a background image to a levelplot

我们两清 提交于 2019-12-11 19:45:10
问题 I'd like to make a levelplot which has a background image. The following code promts the error message Error in rasterImage(image, x[1], y[1], x[length(x)], y[length(y)]) : plot.new has not been called yet - apparently rasterImage does not recognize printed levelplot object as a plot. What's the appropriate method instead of rasterImage ? library("png") library("lattice") library("latticeExtra") MyFunction <- function(x,y){ return( dnorm(sqrt(x^2+y^2)) ) } meshstep <- 0.2 x<- seq(-20,20