View source: R/thematic-save-plot.R
thematic_save_plot | R Documentation |
Uses a device
to capture the result of an expression (expr
)
that produces a plot. If default_device()
is used, custom fonts
(specified through font_spec()
) are guaranteed to work, as long as
one of either the showtext or ragg package(s) are installed.
thematic_save_plot(
expr,
device = default_device(),
filename = tempfile(fileext = ".png"),
...
)
default_device(type = c("png", "svg", "pdf", "tiff", "jpeg"))
expr |
an expression that produces a plot. |
device |
a graphics device to use for capturing the plot. |
filename |
a filename for the produced plot. The file extension should
match the relevant |
... |
arguments passed along to the graphics |
type |
the type of output format |
thematic_save_plot()
returns the filename
of the produced plot
and default_device()
returns a graphics device function.
library(thematic)
font <- font_spec("Rock Salt", scale = 1.25)
thematic_on("black", "white", font = font)
file <- thematic_save_plot(plot(1:10), res = 144)
if (interactive()) browseURL(file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.