oii_finalise_plot: Arrange alignment and save BBC ggplot chart

Description Usage Arguments Value Examples

View source: R/oxford-finalise.R

Description

Running this function will save your plot with the correct guidelines for publication for a BBC News graphic. It will left align your title, subtitle and source, add the BBC blocks at the bottom right and save it to your specified location.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
oii_finalise_plot(
  plot_name,
  source_name,
  save_filepath = file.path(Sys.getenv("TMPDIR"), "tmp-nc.png"),
  height_footer = 0.075,
  width_pixels = 640,
  height_pixels = 450,
  dpi = 1000,
  scale = 1,
  oii_logo = T,
  footer_start = 0.8,
  upper = 1,
  fontsize = 14
)

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 BBC blocks image that sits within the data folder of your package

Value

(Invisibly) an updated ggplot object.

Examples

1
2
3
4
5
6
7
finalise_plot(plot_name = myplot,
source = "The source for my data",
save_filepath = "filename_that_my_plot_should_be_saved_to-nc.png",
width_pixels = 640,
height_pixels = 450,
logo_image_path = "logo_image_filepath.png"
)

schliebs/ggoxford documentation built on Dec. 25, 2021, 12:17 a.m.