View source: R/graphic_functions.R
annotation_compass | R Documentation |
This function adds text to the specified places (using compass style) of a ggplot2 object.
annotation_compass(
label,
position = c("N", "NE", "E", "SE", "S", "SW", "W", "NW"),
padding = grid::unit(c(0.5, 0.5), "line"),
...
)
label |
character. Label of the legend |
position |
Position of the legend. Options are "N", "NE", "E", "SE", "S", "SW", "W", "NW". |
padding |
A numeric vector or unit object specifying x-values and y-values. Default is grid::unit(c(0.5, 0.5), "line") |
... |
Other arguments |
A ggplot2 object with legend.
For more information see here.
## Not run:
g + annotation_compass(label = "sometext", position = "NE") ## Do not run.
## To do the same, you can always use:
g + geom_text(data = data.frame(), aes(label = "sometext",
x = -Inf, y = Inf), hjust = 0, vjust = 1) ## Do not run.
g + ggplot2::annotate(geom = "text", label = "sometext",
x = Inf, y = Inf, hjust = 1,
vjust = 1, size = 24) ## Do not run.
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.