mf_png | R Documentation |
Export a map with the extent of a spatial object in PNG format.
PNG is a raster graphics file format and PNG export should be used for maps that do not require further modification.
If width
is specified, then height
is deduced from the width/height
ratio of x
. Alternatively, if height
is specified, then width
is deduced from the width/height ratio of x
.
This helps to produce maps without too much wasted space.
Use dev.off
to finish the export (see Examples).
mf_png(x, filename = "map.png", width, height, expandBB = rep(0, 4), ...)
x |
object of class |
filename |
path to the exported file |
width |
width of the figure (pixels) |
height |
height of the figure (pixels) |
expandBB |
fractional values to expand the bounding box with, in each direction (bottom, left, top, right) |
... |
further parameters |
No return value, a PNG device is initiated.
mtq <- mf_get_mtq()
(filename <- tempfile(fileext = ".png"))
mf_png(mtq, filename = filename)
mf_map(mtq)
mf_title()
dev.off()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.