R Under development (unstable) (2023-10-23 r85389 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > ## Allow custom widths for barcharts? Currently allowed (without NSE), > ## but could be improved. > > pdf("barchart-width.pdf") > > library(lattice) > x <- 1:10 > names(x) <- sample(LETTERS, 10) > barchart(x, origin = 0) > > barchart(x, origin = 0, box.width = runif(5)) > barchart(x, origin = 0, box.width = runif(5), horizontal = FALSE) > > d <- within(expand.grid(a = gl(4, 1), b = gl(10, 1)), + { + x <- rexp(40) + w <- 0.8 * runif(40) + }) > > barchart(b ~ x | a, data = d, origin = 0, box.width = d$w) > barchart(b ~ x | a, data = d, origin = 0, box.width = d$w[1:10]) > > barchart(b ~ x, data = d, groups = a, box.width = d$w) > > barchart(b ~ x, data = d, groups = a, stack = TRUE, box.width = d$w) > barchart(x ~ b, data = d, groups = a, stack = TRUE, box.width = d$w) > > dev.off() null device 1 > > proc.time() user system elapsed 0.40 0.06 0.45