ragg_png = function(..., res = 150) { ragg::agg_png(..., res = res, units = "in") } knitr::opts_chunk$set(dev = "ragg_png")
library(penngradlings) library(ggplot2) library(grid) library(gridtext)
annotation_textbox
p <- ggplot(mtcars, aes(mpg, hp)) + geom_point() p
annotation <- " <span style=\"font-size:18px; font-family:'Piazzolla-Black';\"> This is a cat:</span> <br><br> <span style=\"font-size:72px; color:'#7950F2'; font-family:'FontAwesome5-Solid';\">cat</span> <br><br> Just look at this <span style=\"font-family:'PiazzollaSC-Regular';\">cat!</span> " tbox1 <- annotation_textbox( html = annotation, position = "top-right", halign = 0.5, ) p + annotation_custom(tbox1)
tbox2 <- annotation_textbox( html = annotation, position = "center", halign = 0.5, valign = 0.5, x_offset = -0.1, y_offset = 0.1, width = 0.4, height = 0.5 ) p + annotation_custom(tbox2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.