How to overlay and place a logo on any R-chart (igraph, ggplot2, etc.) so that I can automatically create branding?

I am wondering if there is a general way to overlay any R-graph / visualization that appears in the R output window with the logo (as well as overlay it), so the output is always branded?

I am reading this post where they use the stripe banner as part of ggplot, but is there a more general way to do this so that I can include it in any output in order to automatically place the appropriate branding in a specific place (awareness of it will probably have to be adjusted, but at least that's the way it always is), so I want it to be part of the "default code template", do I or my colleague use a common plot, igraph, ggplot2 or any other graphic package that will always be overlapping?

0
source share
1 answer

If you are looking for a simple solution, the easiest way to do this is with an overlay plot with a custom background:

require(ggplot2); require(grid); require(png);
data(mtcars)
# read background image, stacks website logo in this case
img <- readPNG(source = "so.png")
# add rater      
g <- rasterGrob(img, interpolate=TRUE) 
# Basic plot
ggplot(mtcars, aes(wt, mpg)) +
    geom_point() +
    annotation_custom(g, xmin=-Inf, xmax=Inf, ymin=-Inf, ymax=Inf)

: plot_with background , , , , .

+1

Source: https://habr.com/ru/post/1616897/


All Articles