anno_plot | R Documentation |
Annotations ggplot2 plot
anno_plot( geom = "plot", x = NULL, y = NULL, xmin = NULL, xmax = NULL, ymin = NULL, ymax = NULL, xend = NULL, yend = NULL, na.rm = FALSE, label = NULL, ... )
geom |
character Name of geom to use for annotation. |
x, y, xmin, ymin, xmax, ymax, xend, yend, |
numeric Positioning aesthetics - you must specify at least one of these. |
na.rm |
logical If |
label |
character, data.frame, ggplot or grob. |
... |
Other named arguments passed on to |
A plot layer instance.
p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() p + anno_plot("text", x = 5, y = 32, label = "Some text") p + anno_plot("label", x = c(2, 5), y = c(15, 32), label = c("A", "B")) p + anno_plot("plot", x = 5.5, y = 34, label = p + theme_bw(9), vp.width = 0.3, vp.height = 0.4) p + anno_plot("rect", xmin = 3, xmax = 4.2, ymin = -Inf, ymax = Inf, alpha = .2, fill = "darkred") p + anno_plot("segment", x = 2.5, xend = 4, y = 15, yend = 25, colour = "blue") p + anno_plot("pointrange", x = 3.5, y = 20, ymin = 12, ymax = 28, colour = "red", size = 1.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.