stamp_textbox.Rd
This function adds a text annotation layer
stamp_textbox( x = 0, y = 0, label = "a *very* nice **label**", alpha = 1, color = "black", fill = "white", family = "Times", hjust = 0.5, lineheight = 0.9, size = 8, vjust = 0.5, orientation = "upright", width = ggplot2::unit(0.8, "npc"), nudge_x = 0, nudge_y = 0, label.padding = ggplot2::unit(0.5, units = "lines"), label.r = ggplot2::unit(0.15, units = "lines"), label.size = 0.3, parse = FALSE, xy = NULL )
label | defaults with a message about use |
---|---|
alpha | numeric between 0 and 1 indicating transparency, defaults to 1 fully opaque, zero is fully transparent |
color | a character string indicating color, defaults to "black", for other named colors check out https://evamaerey.github.io/ggplot2_grammar_guide/named_colors |
fill | a character string indicating fill color, defaults to "grey35", for other named colors check out https://evamaerey.github.io/ggplot2_grammar_guide/named_colors |
family | font family |
hjust | horizontal justification, between 0 and 1, defaults to .5 |
lineheight | spacing between lines if text is wrapped |
size | size of text |
vjust | vertical justification, between 0 and 1, defaults to .5 |
orientation | defaults to upright |
width | numeric for width of box in native plot coordinates, defaults to ? |
nudge_x | Horizontal adjustment to nudge labels by. Useful for offsetting text from points, particularly on discrete scales. |
nudge_y | Vertical adjustment to nudge labels by. Useful for offsetting text from points, particularly on discrete scales. |
label.padding | Amount of padding around label. Defaults to 0.5 lines. |
label.r | Radius of rounded corners. Defaults to 0.15 lines. |
label.size | Size of label border, in mm. |
parse | If TRUE, the labels will be parsed into expressions and displayed as described in ?plotmath. |
xy | a data frame where the first two columns contain x and y positional values |
# labels on a plot library(ggplot2) ggplot(cars) + aes(speed, dist) + geom_point() + stamp_textbox(x = 20, y = 40) + stamp_textbox(x = 20, y = 20, label = "*hello*") + stamp_textbox(label = "**world**", hjust = 0, y = 10, x = 5, fill = "cadetblue2", label.size = 0) + stamp_point()#> Warning: Ignoring unknown parameters: label.padding, label.r, label.size, parse#> Warning: Ignoring unknown parameters: label.padding, label.r, label.size, parse#> Warning: Ignoring unknown parameters: label.padding, label.r, label.size, parse# label on a canvas library(ggtext) ggdraft() + stamp_textbox(40, 30, width = unit(0.3, "npc")) + stamp_point(x = 1:3*10, y = 1)#> Warning: Ignoring unknown parameters: label.padding, label.r, label.size, parse