Aligning footer to y-axis ggplot

Hi, applying the bbc_plot (bbplot/R/finalise_plot.R at master · bbc/bbplot · GitHub) codes for printing the footer at the bottom of the graph when saving the picture.



![image|690x335](upload://kQsILL44nZOsx0epdm7zAdWOiaO.jpeg) 
> create_footer <- function (source_name, logo_image_path) {
>   #Make the footer
>   footer <- grid::grobTree(grid::linesGrob(x = grid::unit(c(0, 1), "npc"), y = grid::unit(1.1, "npc")),
>                            grid::textGrob(source_name,
>                                           x = 0.004, hjust = 0, gp = grid::gpar(fontsize=16)),
>                            grid::rasterGrob(png::readPNG(logo_image_path), x = 0.944))
>   return(footer)
> 
> }

How do I automate the text to align to the y-axis location (0,0) to prevent manual adjusting of x and y axis?

grid::textGrob(source_name,  x = 0.004, hjust = 0, gp = grid::gpar(fontsize=16))

Thank you.

Example, to align "Source: AP, 19:01 ET" to the (0,0) coordinate of the graph.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.