add_logo | R Documentation |
Running this function will add the Eurocontrol logo in your plot and save it to your specified location.
add_logo(plot_name, source_name,
save_filepath = file.path(Sys.getenv("TMPDIR"), "tmp-nc.png"),
width_pixels = 640, height_pixels = 450,
logo_image_path = system.file("extdata", "euctrl-logo-wide.png",
package = "ectrlplot"))
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 chart |
save_filepath |
The exact filepath that you want your 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 Eurocontrol logo that sits within the extdata folder of your package |
library(ggplot2)
myplot <- ggplot(mpg, aes(displ, hwy)) +
geom_point() +
theme_pru() +
labs(title = 'Scatterplot example in ggplot2',
subtitle = 'A plot that is only useful for demonstration purposes')
add_logo(plot_name = myplot,
source = "Source: The source of my data",
width_pixels = 640,
height_pixels = 450,
save_filepath = "path-name.png")
# If you want to use your own logo image,
# change the path in the logo-image-path argument
## Not run:
add_logo(plot_name = myplot,
source = "Source: The source of my data",
save_filepath = "path-name.png",
width_pixels = 640,
height_pixels = 450,
logo_image_path = "use-your-logo-image-path")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.