Skip to contents

It will left align your source, add the DLUHC logo at the bottom right and save it to your specified location.

Usage

finalise_plot(
  plot_name,
  source_name,
  save_filepath = file.path(Sys.getenv("TMPDIR"), "tmp-nc.png"),
  width_pixels = 640,
  height_pixels = 450,
  logo_image_path = file.path(system.file("data", package = "dluhctheme"),
    "DLUHC_Logo.png"),
  footerfontsize = 18,
  save = TRUE
)

Arguments

plot_name

The variable name of the plot you have created that you want to format and save

source_name

The text you want to come after the text 'Source:' in the bottom left hand side of your side

save_filepath

Exact filepath that you want the plot to be saved to

width_pixels

Width in pixels that you want to save your chart to - defaults to 640

height_pixels

Height in pixels that you want to save your chart to - defaults to 450

logo_image_path

File path for the logo image you want to use in the right hand side of your chart, which needs to be a PNG file - defaults to DLUHC image that sits within the data folder of your package

footerfontsize

Size of the font used in the footer

Value

(Invisibly) an updated ggplot object.

Examples

df <- data.frame(replicate(2,sample(1:19,100,rep=TRUE)))
myplot <- ggplot2::ggplot(data = df,ggplot2::aes(x = X1,y=X2)) +
ggplot2::geom_point() +
dluhctheme::dluhc_style() +
ggplot2::scale_y_continuous(expand=c(0,0), limits = c(0,20))

finalise_plot(plot_name = myplot,
source = "Source: The source for my data",
save_filepath = "filename_that_my_plot_should_be_saved_to-nc.png",
width_pixels = 640,
height_pixels = 450,
footerfontsize = 18,
save = TRUE
)