inst/test-scripts/test-plot.factor.R

library(gridGraphics)

require(grDevices)

plot.factor1 <- function() {
    plot(weight ~ group, data = PlantGrowth)           # numeric vector ~ factor
}

plot.factor2 <- function() {
    plot(cut(weight, 2) ~ group, data = PlantGrowth)   # factor ~ factor
    ## passing "..." to spineplot() eventually:
}

plot.factor3 <- function() {
    plot(cut(weight, 3) ~ group, data = PlantGrowth,
         col = hcl(c(0, 120, 240), 50, 70))
}

plot.factor4 <- function() {
    plot(PlantGrowth$group, axes = FALSE, main = "no axes")  # extremely silly
}

plotdiff(expression(plot.factor1()), "plot.factor-1")
plotdiff(expression(plot.factor2()), "plot.factor-2")
plotdiff(expression(plot.factor3()), "plot.factor-3")
plotdiff(expression(plot.factor4()), "plot.factor-4")

plotdiffResult()

Try the gridGraphics package in your browser

Any scripts or data that you put into this service are public.

gridGraphics documentation built on Dec. 15, 2020, 5:10 p.m.