save_custom_plot: Save A Plot With Custom Theming

View source: R/save_custom_plot.R

save_custom_plotR Documentation

Save A Plot With Custom Theming

Description

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(
  filename,
  plot,
  path,
  width = 16,
  height = 16,
  units = "cm",
  dpi = 320
)

Arguments

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.

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.

Value

Nothing, saves plot to disk.


benediktclaus/benelib documentation built on Feb. 1, 2024, 1:39 a.m.