labs_from_labels {SimNPH} | R Documentation |
Add ggplot axis labels from labels attribute
Description
Add ggplot axis labels from labels attribute
Usage
labs_from_labels(gg)
Arguments
gg |
a ggplot object |
Value
a ggplot object
Examples
library("ggplot2")
test <- mtcars
# add a label attribute
attr(test$cyl, "label") <- "cylinders"
# plot witht the variable names as axis titles
gg1 <- ggplot(test, aes(x=wt, y=cyl)) +
geom_point()
gg1
# add labels where defined in the attribute
gg2 <- ggplot(test, aes(x=wt, y=cyl)) +
geom_point()
gg2 <- labs_from_labels(gg2)
gg2
[Package SimNPH version 0.5.5 Index]