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.
Usage
save_custom_plot(
plot,
filename,
path,
width = 16,
height = 16,
units = "cm",
dpi = 320
)
Arguments
- plot
A ggplot2 plot.
- filename
The plot's desired file name.
- 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.
Value
Nothing, saves plot to disk.
Details
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.