如何使用levelplot(LatticeExtra)在单个地图中绘制其他字段?

时间:2019-09-15 01:07:35

标签: r maps levelplot

我正在使用LatticeExtra包的levelplot功能制作流星图。但是,通常,我需要的不仅仅是一张地图中的一个字段。例如:具有风速(阴影)和压力(轮廓)的单个地图(图1)。但是,我真的不知道如何在R中制作此地图堆肥。有什么方法可以在R中制作此样式地图?

是否可以至少绘制一张带有一个阴影区域和其他轮廓的地图?

 Fig1: Meteorological map with tree fiels: Pressure, wind speed and geopotential height

1 个答案:

答案 0 :(得分:0)

例如,您可以绘制连续数据和轮廓(如levelplot examples):

require(lattice)
require(stats)
attach(environmental)
ozo.m <- loess((ozone^(1/3)) ~ wind * temperature * radiation,
               parametric = c("radiation", "wind"), span = 1, degree = 2)
w.marginal <- seq(min(wind), max(wind), length = 50)
t.marginal <- seq(min(temperature), max(temperature), length = 50)
r.marginal <- seq(min(radiation), max(radiation), length = 4)
wtr.marginal <- list(wind = w.marginal, temperature = t.marginal,
                     radiation = r.marginal)
grid <- expand.grid(wtr.marginal)
grid[, "fit"] <- c(predict(ozo.m, grid))
contourplot(fit ~ wind * temperature | radiation, data = grid,
            cuts = 10, region = TRUE,
            xlab = "Wind Speed (mph)",
            ylab = "Temperature (F)",
            main = "Cube Root Ozone (cube root ppb)")

也请查看https://oscarperpinan.github.io/rastervis/#levelplot上的示例。