revert {addScales} | R Documentation |
S3 generic and scaledTrellis method to remove all scaling information from a scaledTrellis
object, returning the prior unscaled trellis object.
revert(obj,...)
## S3 method for class 'scaledTrellis'
revert(obj, ...)
obj |
An object inheriting from class |
... |
Currently ignored |
Returns the last version of the trellis
object with all addScales
scales and legends removed. Note that this is not the original trellis
object if that was subsequently modified by update
calls. See the examples.
A trellis
object that can be printed/plotted as usual.
Bert Gunter bgunter.4567@gmail.com
## Using simple artificial data
set.seed (2233)
x <- rep(1:10,4)
y <- rnorm(40, mean = rep(seq(10, 25, by = 5), each = 10),
sd = rep(1:4, each = 10))
f <- rep(c("AA","BB","CC","DD"), each = 10)
##
## trellis plot the data with "free" y axis sxaling
orig <- xyplot(y ~ x|f, type = c("l","p"), col.line = "black",
scales = list(alternating =1,
y = list(relation = "free")),
as.table = TRUE,
layout = c(2,2),
main = "revert() Example"
)
## Plot it
orig
## Remove the y axis scales and add horizontal scalelines
orig <- update(orig, scales = list(alternating =1,
y = list(relation = "free", draw = FALSE)))
upd1 <- addScales(orig)
## Plot it
upd1
class(upd1)
## revert
upd2 <- revert(upd1)
## Plot it
upd2
class(upd2)
## clean up
rm(x, y, f, orig, upd1, upd2)