Comments (7)
Oh, yes, it's true.
Then try this:
pvc <- vectorplot(r1, region = FALSE,
key.arrow = list(size = 5, label = 'm/s'))
plv <- levelplot(r1, margin = FALSE)
## reuse the legend of vectorplot in levelplot
plv$legend$top <- pvc$legend$top
plv + pvc
from rastervis.
Hi,
You can use the region
argument to display the background. For example:
vectorplot(r1, region = TRUE, key.arrow = list(size = 5, label = 'm/s'))
or with a different Raster
:
vectorplot(r1, region = r2, key.arrow = list(size = 5, label = 'm/s'))
from rastervis.
Hi,
This only applies if the rasters have the same extent, which is not my case. And with your solution, I think I cannot tune neither the order of the layers nor the colorkey for the region.
Best
from rastervis.
Ok, then you have to use as.layer
with under = TRUE
:
pvc <- vectorplot(r1, region = FALSE,
key.arrow = list(size = 5, label = 'm/s'))
plv <- levelplot(r1, margin = FALSE)
pvc + as.layer(plv, under = TRUE)
from rastervis.
No problem!
Cheers.
from rastervis.
Oscar,
Sorry, too fast. No colorkey
for levelplot
appears.
library(rasterVis)
proj <- CRS('+proj=longlat +datum=WGS84')
df <- expand.grid(x=seq(-2, 2, .01), y=seq(-2, 2, .01))
df$z <- with(df, (3*x^2 + y)*exp(-x^2-y^2))
r1 <- rasterFromXYZ(df, crs=proj)
df$z <- with(df, x*exp(-x^2-y^2))
r2 <- rasterFromXYZ(df, crs=proj)
pvc <- vectorplot(r1, region = FALSE, key.arrow = list(size = 5, label = 'm/s'))
plv <- levelplot(r1, margin = FALSE)
pvc + as.layer(plv, under = TRUE)
Cheers
from rastervis.
Thank you, it now works.
from rastervis.
Related Issues (20)
- How to add north arrow and scale bar to every panel? HOT 1
- terra SpatVector on plots? HOT 32
- colorkey labeling change after package update HOT 2
- Problem on Categorical data of multiple layers( levelplot() and gplot() ) HOT 2
- levelplot + latticeExtra::layer not working with terra within functions HOT 3
- Strange 3D output from rasterVis::plot3D when plotting a digital elevation model HOT 2
- Add north arrow and scale in levelplot outside the plot HOT 1
- how to manipulate the xlim and ylim for vectorplot? HOT 2
- Using stacked SpatRaster HOT 1
- can't get rid of grey peaks around continuous levelplot HOT 3
- gplot in rasterVis over-aggregates raster HOT 6
- `levelplot()`: Add support for alternate ID name for SpatRaster HOT 1
- R rasterVis levelplot: appear lines without drawing when using levelplot function HOT 2
- levelplot(<SpatRaster>) and default behavior of `subst()` w/ terra 1.6-x+ HOT 1
- maptools retirement HOT 2
- layer overwriting if saving levelplot to list in loop HOT 2
- levelplot do not show longitude and latitude units HOT 2
- face='bold' of axis.text do not work and axis.line only control left and bottom in gplot HOT 4
- Categorical values not displayed on legend HOT 1
- levelplot not showing categorical classes on legend HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rastervis.