View source: R/save_custom_plot.R
save_custom_plot | R Documentation |
The various use_*
functions from the benelib
are powered by the
thematic
package. This powerful package makes it possible to use custom
Google fonts without worrying about plotting those. However, this comes with
a small drawback for saving plots. If one uses ggplot2's
ggsave
function, text may be rendered too small in
raster images. thematic
provides a custom function, for which this
function is a simple wrapper.
save_custom_plot(
filename,
plot,
path,
width = 16,
height = 16,
units = "cm",
dpi = 320
)
filename |
The plot's desired file name. |
plot |
A ggplot2 plot. |
path |
The desired path to which the plot should be saved. |
width |
Plot width, defaults to 16. |
height |
Plot height, defaults to 16. |
units |
Plot dimension unit, defaults to "cm". |
dpi |
Plot resolution, defaults to 320. |
In short: if you use a plot theming function from this package and want to save it as a raster image (JPG, PNG, etc.), use this function to save the plot to a desired location.
Nothing, saves plot to disk.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.