search for: prepanel

Displaying 20 results from an estimated 105 matches for "prepanel".

2012 May 17
3
New Eyes Needed to See Syntax Error
...rb.R") : bicarb.R:15:1: unexpected symbol 14: 15: hco33 ^ The 'h' is in column 0 so the caret would be column -1, but it's presented as column 1. The file, bicarb.R is: hco31 <- qqmath(~ HCO3 | factor(basin), data = surfchem.cast, main = 'Bicarbonate (Raw)', prepanel = prepanel.qqmathline, panel = function(x, ...) { panel.qqmathline(x, ...) panel.qqmath(x, ...) }) hco32 <- qqmath(~ log10(HCO3 | factor(basin), data = surfchem.cast, main = 'Bicarbonate (Log10)', prepanel = prepanel.qqmathline, panel = function(x, ...) { pan...
2006 Oct 12
2
adding error bars to lattice plots
...annot figure out where they should go. Deepayan's original code follows, with additions from me for factor, grouping and by variables. (Note that I could use xYplot (Dotplot), but I need my response variable on the vertical axis.) Any suggestions would be greatly appreciated. Thanks, Dan prepanel.ci <- function(x, y, lx, ux, subscripts, ...) { x <- as.numeric(x) lx <- as.numeric(lx[subscripts]) ux <- as.numeric(ux[subscripts]) list(xlim = range(x, ux, lx, finite = TRUE)) } panel.ci <- function(x, y, lx, ux, subscripts, pch = 16, ...) {...
2012 Jun 25
0
"Tight" Axes in Prepanel Function
How do I specify a "tight" y-axis, where the plot completely fills the y-axis range, inside the prepanel function? For example, consider the following code: require(lattice) set.seed(12345) x <- 1:1000 y <- cumsum(rnorm(length(x))) prepanel.test <- function(x, y, groups = NULL, subscripts = NULL, ...) { if (is.null(groups)) { result <- list(ylim = range(y)) } else { result...
2006 Jun 06
2
error bars in lattice xyplot *with groups*
...ge=factor(rep(c("Bass","Tenor","Alto","Soprano"),each=2)) #here's Deepayan's previous solution, slightly modified to depict # the dependent variable (median) and the error bars on the y-axis # and the independent variable (voice.part) on the x-axis prepanel.ci <- function(x, y, ly, uy, subscripts, ...) { x <- as.numeric(x) ly <- as.numeric(ly[subscripts]) uy <- as.numeric(uy[subscripts]) list(ylim = range(y, uy, ly, finite = TRUE)) } panel.ci <- function(x, y, ly, uy, subscripts, pch = 16, ...) { x <- as.numeric(x...
2005 Jun 15
2
Plotting second axes outside xyplot
Hi all, I'm trying to find a way to get xyplot to produce a second set of axes outside the right hand side of the graph. This is my progress so far: EE <- equal.count(ethanol$E, number=9, overlap=1/4) xyplot(NOx ~ C | EE, data = ethanol, prepanel = function(x, y) prepanel.loess(x, y, span = 1), xlab = "Compression Ratio", ylab = "NOx (micrograms/J)", panel = function(x, y) { panel.grid(h=-1, v= 2) panel.xyplot(x, y) panel.loess(x,y, span=1) panel.axis(side = &...
2006 Oct 11
1
panel-dependent distribution in qqmath
...bout having 'distribution' change with panel.number? I've tried set.seed(1) mydata <- data.frame(ind = factor(rep(2:4, each = 100))) mydata$val <- rt(300, df=rep(2:4, each = 100)) plot<-qqmath(~ val | ind, layout=c(3,1), data = mydata, prepanel = function(x, distribution, ...) { mydist<-function(p) qt(p, df = panel.number() + 1) prepanel.qqmathline(x, distribution=mydist,...) }, panel = function(x, distribution, ...) { mydist<-function(p) qt(p, df = panel.numb...
2010 May 25
2
segplot (latticeExtra)
...or dotplot in another thread, the following looked promising, but gives empty panels: ---<--------------------cut here---------------start------------------->--- segplot(reorder(factor(county), rate.male) ~ LCL95.male + UCL95.male | year, data=uscr.w, scales="free", prepanel=function(x, y, z, ...) { zz <- z[, drop=TRUE] list(sort(unique(zz))) }, panel=function(x, y, z, ...) { zz <- z[, drop=TRUE] panel.segplot(x, y, zz, ...) }) ---<--------------------cut here---------------end------------...
2005 Feb 16
1
panel/prepanel for polar plots ala xYplot
...mostly I have been reverse engineering code and experimenting to figure out how things work. 2) What is the best way to generate "axis" and labels for them? Currently my radplot is a wrapper for xyplot that (a) turns off the axes and labels, and (b) calls xyplot with panel.radplot, prepanel.radplot, and radplot.superpose replacing the obvious things. I am generating the "axes" (concentric circles and peripheral labels) in panel.radplot, but this means that they are redrawn for each group when there is superposition. Furthermore, there seems to be some jittering, so bes...
2002 Mar 27
0
Re: RE Vertical bars with barchart()
...best approach to do it. It's definitely not trivial, mainly because Trellis is not designed to handle factors on the x-axis (chiefly for convenience, as factors typically have long names which are difficult to write on the x-axis). Anyway, what you essentially need to do is 1. Change the prepanel function so that you get the correct x and y axis ranges. 2. Change the panel function to draw what you want 3. Write the y- and x-axes labels explicitly The first step is trivial if you use the default prepanel for barchart etc (it's not very obvious, but barchart, dotplot etc all use a funct...
2009 Oct 30
1
insert a text in panels, always in the same position (lattice, ltext, ?prepanel?)
...panel, but this obviously overlay the text to the points. What I'm looking for is to write the text always in the same position along the panels, say in the middle of each panel something like "ltext(x = 1.5, y = (ylim[2] - ylim[1])/2 )" I tried to play with "ylim" and prepanel but unsuccesfully. Thank a lot in advance ################################################################################# df <- expand.grid(a = gl(3,1), b = gl(2,1), c = gl(2,1), d = gl(2,1), rep = gl(3,1)) df$x <-rnorm(nrow(df))...
2006 Mar 01
2
lattice-Internal
Hi, The functions prepanel.default.bwplot() and lpretty() are not running in Deepayan's barley example concerning vertical bars with the lattice function barchart(). Why, is there a restricted use for the package lattice-Internal? Urs Simmen mailto:usimmen at dtc.ch
2008 Oct 08
1
Choose subset for plot use (bwplot)
...tor(dat11$RecovUnit) # plot: require(lattice) bwplot(bbED~ Pri_No | RecovUnit, data=dat11, as.table=TRUE, layout=c(4,1)) This works, but I am trying to do this: > bwplot(bbED~ Pri_No | RecovUnit, data=dat11, subset = (Pri_No %in% c(1,2)), as.table=TRUE, layout=c(2,1)) Error in limits.and.aspect(prepanel.default.bwplot, prepanel = prepanel, : need at least one panel How can I choose only two groups from 'Pri_No'? Thank you kindly, Michael Just [[alternative HTML version deleted]]
2002 Oct 23
0
New version of lattice (possible incompatibility with old code)
Hi, there's a new version of lattice on CRAN (0.6-5) which will probably ship with R 1.6.1. It has a minor change in API which might affect packages using lattice -- only if they define panel/prepanel functions of their own. In previous versions, it was implicitly assumed that panel (and prepanel) functions would only be supplied _numeric_ x,y,z arguments, although I don't remember this as being documented. This has changed in the new version (mostly to allow rudimentary POSIXt labelling and...
2011 Aug 02
1
lattice: index plot
...ing multiple panels. I tried something like library(lattice) mp <- function(x, y, ...) { x <- 1:length(y) panel.xyplot(x, y, ...) } pp <- function(x, y, ...) { list(xlim = extendrange(1:length(y)), ylim = extendrange(y)) } set.seed(123) y <- rnorm(10) xyplot(y ~ 1, panel = mp, prepanel = pp, xlab="Index") but I was wondering whether there is a more straightforward way? By the way, if I do not specify the ylim in the prepanel function the plot is clipped, but reading Deepayan's book, p.140 : "[...], so a user-specified prepanel function is not required to ret...
2010 Nov 10
0
error bars in lattice barchart
...eepayan and Sundar about adding error bars to the lattice plots ( https://stat.ethz.ch/pipermail/r-help/2006-October/114883.html), but I still have the problem when I want to adding error bars to barchart. I tried both the solution of Deepayan and Sundar but without luck. Here is my code (I changed prepanel.ci and panel.ci a little to plot bars vertically): ###################### Sundar's solution ############################### prepanel.ci <- function(x, y, ly, uy, subscripts, ...) { y <- as.numeric(y) ly <- as.numeric(ly[subscripts]) uy <- as.numeric(uy[subscripts])...
2008 Jun 26
3
Connecting lines across missing data points, xyplot
...rep(c("D", "P"), each = 5), Aldo = c(13, NA, NA, 15, 14, 12, NA, NA, 14, 13), SE.Aldo = c(3, NA, NA, 3, 3, 2, NA, NA, 2, 2), lower.ci.Aldo = c(10, NA, NA, 12, 11, 10,NA, NA, 12, 11), upper.ci.Aldo = c(16, NA, NA, 18, 17, 14, NA, NA, 16, 15) ) ## functions for the error bars prepanel.ci <- function(x, y, ly, uy, subscripts, ...) { x <- as.numeric(x) ly <- as.numeric(ly[subscripts]) uy <- as.numeric(uy[subscripts]) list(ylim = range(y, uy, ly, finite = TRUE)) } panel.ci <- function(x, y, ly, uy, subscripts, pch = 16, ...) { x <- as.numeric(x...
2006 May 07
1
nlme plot residuals per group
...ng to the great Pinheiro/Bates book, on R2.3, WinXp Lac.lme is an lme object with unbalanced data, group is a factor variable with three levels, when I tried to plot the residuals by group I got this error msg: >plot(Lac.lme,resid(.,type='p')~fitted(.)|group) Error in limits.and.aspect(prepanel.default.xyplot, prepanel = prepanel, : need at least one panel Also When I try to use the auPred() function I get the follwoing error msg: >plot(augPred(Lac.lme)) Error in tapply(as.character(object[[nm]]), groups, FUN[[dClass]]) : arguments must have same length Any suggestio...
2003 Sep 17
2
Date on x-axis of xyplot
...3rd Qu.:12.000 Graham : 54 Max. :29.000 Kerry : 54 (Other) :216 > And all seems well. But xyplot continues to use day number on the x-axis. My plots are created by print(xyplot(pct ~ begdate | names, pch=2, cex=.2, prepanel = function(x, y) prepanel.loess(x, y, span = 1), main="2004 Democratic Primary Race", xlab = "Date of Survey", ylab = "Percent Support", panel = function(x, y) { panel.grid(h=-1, v= -1) panel.xyplot(x, y, pch=1,col=2,cex=.7) panel.loess...
2008 Nov 19
0
Buggy trellis.focus() with xyplot in JavaGD ?
...5 Note: It's important to you use JGR to use the Java Graphics Device. *** To Replicate the Bug ***: 1.- display an xyplot. For example, from the xyplot help page: library(lattice) require(stats) EE <- equal.count(ethanol$E, number=9, overlap=1/4) ## Constructing panel functions on the fly; prepanel xyplot(NOx ~ C | EE, data = ethanol, prepanel = function(x, y) prepanel.loess(x, y, span = 1), xlab = "Compression Ratio", ylab = "NOx (micrograms/J)", panel = function(x, y) { panel.grid(h=-1, v= 2) panel.xyplot(x, y) panel....
2005 Jan 17
2
bwplot: how not to draw outliers
...oc do I need to consult)? > The options that have this effect in boxplot() do not appear to have any effect with bwplot (although outline=FALSE in boxplot does *not* change the scaling). > > Thanks, > RenE Bertin > RenE, There may be other solutions but you can do this using the prepanel option to set the ylim: library(lattice) set.seed(1) z <- data.frame(x = rt(100, 1), g = rep(letters[1:4], each = 25)) bwplot(x ~ g, z, prepanel = function(x, y) { bp <- boxplot(split(y, x), plot = FALSE) ylim <- range(bp$stats) list(ylim = ylim)...