bolus.ggplot {ggplot2}R Documentation

Create a bolus object

Description

A bolus is a list suitable for digesting.

Usage

bolus.ggplot(x, ...)

Arguments

x
...

Details

Most ggplot objects have components that should be hashed when creating a digest (especially since most ggplot objects are proto objects and are also self-documenting). The bolus methods ensure that only appropriate components are digested.

Author(s)

Hadley Wickham <h.wickham@gmail.com>

Examples

hash_tests <- list(
list(
ggplot() + scale_x_continuous() + scale_y_continuous(),
ggplot() + scale_y_continuous() + scale_x_continuous()
),
list(
qplot(mpg, wt, data=mtcars, na.rm = FALSE),
ggplot(mtcars, aes(y=wt, x=mpg)) + geom_point()
),
list(
qplot(mpg, wt, data=mtcars, xlab = "blah"),
qplot(mpg, wt, data=mtcars) + scale_x_continuous("blah")
)
)

lapply(hash_tests, function(equal) {
hashes <- lapply(equal, digest.ggplot)

if (length(unique(hashes)) != 1) {
lapply(equal, function(x) print(str(bolus(x))))
stop("Above plots not equal")
}
})

[Package ggplot2 version 0.8.2 Index]