Open
Description
I noticed that the plots are no longer working if the layer annotation_map_tile
is included in the code. To make sure it wasn't my data, I checked with the code example given on the ggspatial
homepage (https://paleolimbot.github.io/ggspatial/).
The following code returns this error:
Error in annotation_map_tile()
:
! Problem while converting geom to grob.
ℹ Error occurred in the 1st layer.
Caused by error in loadNamespace()
:
! there is no package called 'prettymapr'
# Code from ggspatial package homepage demonstrating how it works
library(ggplot2)
library(ggspatial)
load_longlake_data()
ggplot() +
# loads background map tiles from a tile source
annotation_map_tile(zoomin = -1) +
# annotation_spatial() layers don't train the scales, so data stays central
annotation_spatial(longlake_roadsdf, size = 2, col = "black") +
annotation_spatial(longlake_roadsdf, size = 1.6, col = "white") +
# raster layers train scales and get projected automatically
layer_spatial(longlake_depth_raster, aes(colour = after_stat(band1))) +
# make no data values transparent
scale_fill_viridis_c(na.value = NA) +
# layer_spatial trains the scales
layer_spatial(longlake_depthdf, aes(fill = DEPTH_M)) +
# spatial-aware automagic scale bar
annotation_scale(location = "tl") +
# spatial-aware automagic north arrow
annotation_north_arrow(location = "br", which_north = "true")
However, when I comment out the annotation_map_tile()
layer, the plot does run, but obviously does not include a basemap:
ggplot() +
# loads background map tiles from a tile source
#annotation_map_tile(zoomin = -1) +
# annotation_spatial() layers don't train the scales, so data stays central
annotation_spatial(longlake_roadsdf, size = 2, col = "black") +
annotation_spatial(longlake_roadsdf, size = 1.6, col = "white") +
# raster layers train scales and get projected automatically
layer_spatial(longlake_depth_raster, aes(colour = after_stat(band1))) +
# make no data values transparent
scale_fill_viridis_c(na.value = NA) +
# layer_spatial trains the scales
layer_spatial(longlake_depthdf, aes(fill = DEPTH_M)) +
# spatial-aware automagic scale bar
annotation_scale(location = "tl") +
# spatial-aware automagic north arrow
annotation_north_arrow(location = "br", which_north = "true")
I am using R version 4.4.2 "Pile of Leaves" and ggspatial 1.1.9
Metadata
Metadata
Assignees
Labels
No labels
Activity