get_labels | R Documentation |
get_labels()
returns a named list of labels,
written as character strings, indicating which labels are used by a plot.
get_labels(p, aes = NULL)
p |
A ggplot object |
aes |
If |
Note that get_labels()
will return NULL
if a label is explicitly set to
NULL
or if a requested aesthetic is not present in the plot.
A named list of character strings.
Other functions for checking labels:
get_default_labels()
,
uses_labels()
require(ggplot2)
p <- ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +
geom_point(mapping = aes(color = class)) +
geom_smooth() +
labs(x = "Weight", y = "MPG", color = NULL)
get_labels(p)
get_labels(p, c("x", "y"))
# The colo(u)r aesthetic can be matched with or without a u
get_labels(p, "color")
get_labels(p, "colour")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.