R在渲染图上绘制

时间:2019-07-28 09:17:08

标签: r ggplot2 plot sf

我有一个基本图,我想在上面叠加一些数据(我将创建多个图来叠加相同的基本图),并且想知道是否有一种方法可以“预渲染”并保存基本图,然后在以后绘制一些数据,以节省渲染时间。

我当前的代码如下:

library(sf)
library(ggplot2)

...

base_plot <- ggplot() + 
  geom_sf(data = coast) + 
  geom_sf(data = roads) + 
  theme_bw() +
  coord_sf(crs = "+proj=longlat +zone=33", xlim = c(10.54433, 10.92609), ylim = c(59.88134, 59.98148), expand = FALSE, datum = NA)

base_plot + geom_sf(data = some.data_1)
base_plot + geom_sf(data = some.data_2)
...

0 个答案:

没有答案