Title: | MAKING GGPLOT GRAPHICS IN BBC NEWS STYLE |
---|---|
Description: | Helps create and export ggplot2 charts in the style used by the BBC News data team thanks to two useful functions, one for styling and another for exporting ggplot graphics |
Authors: | Nassos Stylianou [aut, cre], Will [email protected] Dahlgreen [aut], Robert [email protected] Cuffe [aut], Tom Calver [aut], Ransome Mpini [aut] |
Maintainer: | Nassos Stylianou <[email protected]> |
License: | GPL-2 |
Version: | 0.2 |
Built: | 2025-01-01 02:49:27 UTC |
Source: | https://github.com/bbc/bbplot |
This function allows you to add the bbc theme to your ggplotgraphics.
bbc_style()
bbc_style()
line <- ggplot(line_df, aes(x = year, y = lifeExp)) + geom_line(colour = "#007f7f", size = 1) + geom_hline(yintercept = 0, size = 1, colour="#333333") + bbc_style()
line <- ggplot(line_df, aes(x = year, y = lifeExp)) + geom_line(colour = "#007f7f", size = 1) + geom_hline(yintercept = 0, size = 1, colour="#333333") + bbc_style()
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.
finalise_plot(plot_name, source_name, save_filepath, width_pixels = 640, height_pixels = 450, logo_image_path = file.path(system.file("data", package = "bbcggplotr"), "bbc_blocks_r.png"))
finalise_plot(plot_name, source_name, save_filepath, width_pixels = 640, height_pixels = 450, logo_image_path = file.path(system.file("data", package = "bbcggplotr"), "bbc_blocks_r.png"))
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 |
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" )
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" )