Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (30 sloc) 0.687 kb
# Name ggplot grid object
# Convenience function to name grid objects
#
# @keyword internal
ggname <- function(prefix, grob) {
grob$name <- grobName(grob, prefix)
grob
}
width_cm <- function(x) {
if (is.grob(x)) {
convertWidth(grobWidth(x), "cm", TRUE)
} else if (is.list(x)) {
vapply(x, width_cm, numeric(1))
} else if (is.unit(x)) {
convertWidth(x, "cm", TRUE)
} else {
stop("Unknown input")
}
}
height_cm <- function(x) {
if (is.grob(x)) {
convertWidth(grobHeight(x), "cm", TRUE)
} else if (is.list(x)) {
vapply(x, height_cm, numeric(1))
} else if (is.unit(x)) {
convertHeight(x, "cm", TRUE)
} else {
stop("Unknown input")
}
}
Jump to Line
Something went wrong with that request. Please try again.