| print_map | R Documentation |
Renders a mapgl map as a static PNG image for display. When called inside a
knitr/Quarto document, the map is included as a static figure via
knitr::include_graphics(). In an interactive session, the image is
displayed in the R graphics device.
print_map(
map,
width = 900,
height = 500,
include_legend = TRUE,
hide_controls = TRUE,
include_scale_bar = TRUE,
basemap_color = NULL,
image_scale = 1,
background = "white",
delay = NULL
)
map |
A map object created by |
width |
Integer. The width of the map viewport in pixels. Always
overrides any |
height |
Integer. The height of the map viewport in pixels. Always
overrides any |
include_legend |
Logical. Include the legend in the output? Default
|
hide_controls |
Logical. Hide navigation and other interactive controls?
Default |
include_scale_bar |
Logical. Include the scale bar? Default |
basemap_color |
Character string or |
image_scale |
Numeric. Scale factor for the output image. Use |
background |
Character string or |
delay |
Numeric or |
In a knitr context, the result of knitr::include_graphics().
In an interactive session, the image is displayed and the temporary file
path is returned invisibly.
## Not run:
library(mapgl)
map <- maplibre(
center = c(-96, 37.8),
zoom = 3
)
# In a Quarto document chunk
print_map(map)
# With custom dimensions
print_map(map, width = 1200, height = 800, image_scale = 2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.