Git Product home page Git Product logo

Comments (7)

oscarperpinan avatar oscarperpinan commented on September 28, 2024 1

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.

oscarperpinan avatar oscarperpinan commented on September 28, 2024

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.

pascaloettli avatar pascaloettli commented on September 28, 2024

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.

oscarperpinan avatar oscarperpinan commented on September 28, 2024

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.

oscarperpinan avatar oscarperpinan commented on September 28, 2024

No problem!

Cheers.

from rastervis.

pascaloettli avatar pascaloettli commented on September 28, 2024

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)

rplot

Cheers

from rastervis.

pascaloettli avatar pascaloettli commented on September 28, 2024

Thank you, it now works.

rplot

from rastervis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.