Re: [R] lattice panel.lmline problem

2007-09-10 Thread Deepayan Sarkar
anel.xyplot(x, y, ...) if (length(x) > 0) panel.lmline(x, y, ...) }) x[subscripts] inside the panel function doesn't give anything meaningful ('x' is already subscripted). -Deepayan > > Ross Darnell > > > -Original Message- > From: Frede

Re: [R] labelling specific points xyplot

2007-09-06 Thread Deepayan Sarkar
groups, subscripts = subscripts, ...) labels <- labels[subscripts] do.labels <- do.labels[subscripts] panel.text(x[do.labels], y[do.labels], labels = labels[do.labels], pos = 1, cex=0.5, ...) }) -Deepayan _

Re: [R] Lattice: key with expression function

2007-09-05 Thread deepayan . sarkar
n' outside or just after the paste function it also > doesn't work. auto.key = list(text = expression(paste("foo", degree))) should work. I think the problem is that you want a vector of expressions, and that's a bit harder to g

Re: [R] Multiple xyplots

2007-09-05 Thread deepayan . sarkar
s(x = 0:20/21, y = sin(70 * runif(1) * 0:20/21), vp = viewport(x = runif(1), y = runif(1), height = 0.05, width = 0.05)) See the package documentation, or Paul Murrell's book "R Graphics" for more. -Deepayan __ R-help@stat

Re: [R] [Lattice] Incrase the height of strips in Trellis plots

2007-09-05 Thread deepayan . sarkar
Petal.Length ~ Petal.Width | Species, iris, par.strip.text = list(lines = 2, cex = 2)) -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/post

Re: [R] Lattice: panel superpose with groups

2007-09-04 Thread Deepayan Sarkar
On 9/4/07, Folkes, Michael <[EMAIL PROTECTED]> wrote: > Thank you again Deepayan. I was failing to grasp that I could use > panel.groups as a function. But additionally it's still not intuitive > to me where and when I should use "..." to pass arguments on. In mo

Re: [R] Lattice: panel superpose with groups

2007-09-04 Thread Deepayan Sarkar
l', groups = temp , panel = panel.superpose, panel.groups = function(x, y, ..., lty) { panel.xyplot(x, y, ..., lty = lty) #panel.lines(x, rep(mean(y),length(x)), lty=3, ...) # or panel.abline(h = mean(y), lty=3, ...) }) (see

Re: [R] lattice xyplot with bty="l"

2007-09-04 Thread Deepayan Sarkar
), y = c(0, 0), default.units = "npc") axis.default(side = side, ...) }) -Deepayan > > An example: > > --8<---cut here---start->8--- > rm(list=c(ls())) > library(lattice) > &

Re: [R] plotting predicted curves with log scale in lattice

2007-09-03 Thread Deepayan Sarkar
is is a transformation of the data, not the axes. Other than the axis labeling, using this feature is no different than transforming the data in the formula; e.g., 'scales=list(x = list(log = 2))' is equivalent to 'y ~

Re: [R] Lattice:can't subset in panel function using other variables

2007-08-31 Thread Deepayan Sarkar
On 8/31/07, Folkes, Michael <[EMAIL PROTECTED]> wrote: > Thanks Deepayan for your response. > The first subset you suggest was just a test for me and not what I > wanted. > I can't do your second suggested subset action as I wish to plot all the > panel data, but then ad

Re: [R] Assigning line colors in xyplot

2007-08-31 Thread Deepayan Sarkar
On 8/31/07, Christof Bigler <[EMAIL PROTECTED]> wrote: > The suggestions by Deepayan Sarkar and Hadley Wickham work for that > case, but I get into troubles when I try to draw e.g. a panel for "A" > and "B": > > xyplot(y ~ x | f , groups=g, dat

Re: [R] Sweave rendering of simple character

2007-08-31 Thread Deepayan Sarkar
it more formal than I wanted > for demonstrating the use of the help shortcut. > I would like the output to look like, > > > ?HSP > > but I can't seem to make this work. I'm not familiar with the Scode environment, but <>= ?HSP @ does what you want. -Deep

Re: [R] Lattice:can't subset in panel function using other variables

2007-08-31 Thread Deepayan Sarkar
mydata$yr==2005],y[mydata$yr==2005],type='p',pch=16,col=2,cex=.5) > # <-sometimes this won't work or it colours wrong datapoint > })) > ___ Why not xyplot(yval~xval|week,data=mydata, subset = yval < 40) or xyplot(yval~xval|week,data=myda

Re: [R] Need help putting histograms on the diagonal of a splom plot

2007-08-31 Thread Deepayan Sarkar
:4]) For a histogram, things are a bit more complicated, but still easy enough: my.plot = function(data) { splom( ~data #, lower.panel=... #, upper.panel=... , diag.panel = function(x, ...) { yrng <- current.panel.limits()$ylim d <- density(x)

Re: [R] Additions to xyplot (lattice)? - legend, ticks, axis label size, text

2007-08-31 Thread Deepayan Sarkar
gt; > >scales = list(x = list(at = c(1, 2, 3), labels = c("a", "", "c"))) > > > >etc. > > So no ticks without labels, as specified by the user? The above generates > only ticks with labels. Yes, but the second l

Re: [R] Bug?

2007-08-31 Thread Deepayan Sarkar
an internal variable called 'linebuffer'). Since this doesn't seem to be a common problem, you need to give us instructions on how to reproduce it. -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-he

Re: [R] customizing the color and point shape for each line drawn using lattice's xyplot

2007-08-30 Thread deepayan . sarkar
vels of 'groups'. If you want fewer colors (or not have unused colors in the legend), you need to make sure your 'groups' variable has a suitably reduced set of levels. There is no cute way to do this. The long way is subdata <- subset(common, Method != 4) subdata$Me

Re: [R] Additions to xyplot (lattice)? - legend, ticks, axis label size, text

2007-08-30 Thread deepayan . sarkar
quot;, "points")), lines = list(lwd = 2.5, col = c("gray", "blue"), cex = 1.25, pch = 19, type = c("p", "l"))) -Deepayan __ R-help@stat.mat

Re: [R] Additions to xyplot (lattice)? - legend, ticks, axis label size, text

2007-08-30 Thread deepayan . sarkar
text = list("points"), points = list(pch=19, col="blue", cex=1.25)) > (4) Add some annotation (text) in the lower left corner ('text' for plot() > did not work) Use panel.text() instead inside your panel function. -Deepayan > I'm relatively

Re: [R] Assigning line colors in xyplot

2007-08-30 Thread deepayan . sarkar
t is, the colors are recycled alternately in the order the > individuals appear in the plot (1, 10, 11, 12, 2, ..., 9). > > How can I assign the red color to all individuals of group "A" and the > blue color to all individuals of group "B"? Why not simply use f as the

Re: [R] xyplot() groups scope issue

2007-08-30 Thread deepayan . sarkar
e formula: do.xyplot = function( plot.formula, data.frame, plot.groups){ print(plot.groups) environment(plot.formula) <- environment() # new xyplot( plot.formula ,data = data.frame ,groups = eval(plot.groups) ) } -Deepayan

Re: [R] FAQ 7.x when 7 does not exist. Useability question

2007-08-23 Thread Deepayan Sarkar
in http://dsarkar.fhcrc.org/R/RFAQ-2.png The only problem here is that there is no way to distinguish between the chapter listing and the section listings (both are ). If that could be made to have a different class, the chapter listing could be improved. -Deepayan ___

Re: [R] small issue with densityplot

2007-08-21 Thread Deepayan Sarkar
On 8/21/07, Douglas Bates <[EMAIL PROTECTED]> wrote: > On 8/21/07, Horace Tso <[EMAIL PROTECTED]> wrote: > > Deepayan, you're right. Now I realize anyone could write a densityplot > > function to apply on a different class of objects. I guess I should write >

Re: [R] Stacked Bar

2007-08-21 Thread Deepayan Sarkar
, > key = key ) > === A more transparent solution (IMO) is something like barchart(Freq ~ Var2, data = as.data.frame.table(x), groups = Var1, stack = TRUE, par.settings = list(superpose.polygon = list(col=rainbow(nrow(x, auto.key = list(sp

Re: [R] small issue with densityplot

2007-08-21 Thread Deepayan Sarkar
all possible methods, especially those in other packages. I would say that since you are using mcmcsamp(), it's perfectly reasonable to expect you to look at its help page to figure out what you can do with the results. What gave you the idea that densityplot would work on the result of mcmcsamp

Re: [R] to combine bwplot + srt option?

2007-08-16 Thread Deepayan Sarkar
ich case the default string rotation is optimal. -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, se

Re: [R] 'From' and 'to' arguments in panel.abline

2007-08-13 Thread Deepayan Sarkar
) etc. If you want to limit the range, use panel.curve, e.g. panel.curve(0 + 1 * x,from=0,to=10) -Deepayan > If so, how should they > be specified? > > xy<-data.frame(x<-0.1:10,y<-0.1:10) > xyplot(y~x,data=xy, > panel = function(x, y, ...){ &g

Re: [R] xyplot() with segments() superposed?

2007-08-13 Thread Deepayan Sarkar
pattern over days and mark the > quit attempts. Hope this is clear. Sounds like you need to pass your 'tkmarks' variable on to the panel function and then use 'subscripts' inside your panel function. Read the entry on 'panel' in ?xyplot. Also,

Re: [R] xyplot() with segments() superposed?

2007-08-13 Thread Deepayan Sarkar
dvance, > > Yuelin Li. > > ps. part of the code came from a solution given by Deepayan Sarkar. > > --- > library(lattice) > set.seed(12345) > x <- 0:20 > y.male.obs <- - 1.2 * x + 22 + rnorm(length(x), sd = 3) > y.male.prd <- - 1.2 * x +

Re: [R] using loops to create multiple images

2007-08-05 Thread Deepayan Sarkar
g dev.copy? See ?png, in particular how the ``page number'' can be encoded in the 'filename' argument for multi-page output. -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do re

Re: [R] Question regarding QT device

2007-08-05 Thread deepayan . sarkar
On 8/5/07, Saptarshi Guha <[EMAIL PROTECTED]> wrote: > Hi, > After a few modifications in the makefiles, I successfully compiled > the Qt device (written by Deepayan Sirkar) for OS X 10.4.9 on a > Powerbook. Cool, can you send me the modifications? I haven't managed t

Re: [R] Background color of symbols in xyplot

2007-08-03 Thread deepayan . sarkar
change in the following code to make it work ? > > key=list(space="bottom", > points = list(pch = 21:25, > col = 32, > bg=15), > text=list(mylegend)), For starters, upgrade to the latest version of R and latt

Re: [R] warning messages in grid or lattice give that I can't debug

2007-08-02 Thread deepayan . sarkar
On 8/2/07, Richard M. Heiberger <[EMAIL PROTECTED]> wrote: > Thanks Deepayan. > > Does that translate that I don't have to do anything else, > and that I can submit the package in its present state to CRAN? No, you have to make sure that 'fill' is not a factor.

Re: [R] Xyplot - adding model lines to plotted points

2007-08-02 Thread Deepayan Sarkar
several ways to do that; options include reshape(), make.groups(), and the reshape package. After that, something like xyplot(len ~ age | as.factor(cohort), data = <...>, groups = interaction(sex, source), type = c("p", "p", "l", "l"), d

Re: [R] warning messages in grid or lattice give that I can't debug

2007-08-02 Thread Deepayan Sarkar
least in a zen kind of way). I presume you are somehow protecting 'col' from becoming a factor, and that does not translate to 'fill'. This behaviour (of HH) is not new, and I believe you will see the same output as above in R 2.4. What's new is that 'fill'

Re: [R] Splom custom superpanels

2007-08-01 Thread Deepayan Sarkar
= brewer.pal(9, "RdBu")[ round(cor(x, y) * 4 + 5)]) panel.text(mean(x), mean(y), round(cor(x, y),2), font=2) } panel.pairs(..., lower.panel = my.lower.panel) } splom(foo, superpanel = my.panel.pairs) -Deepayan __ R-help@

Re: [R] add custom strip to lattice plot

2007-08-01 Thread Deepayan Sarkar
d.text(round(mean(y), 3), 0.5, 1, vjust = 1.2) }) The text can be put into a rectangle, to make them look like strips, and you could use a prepanel function to make sure there's enough space for it. Look up grid documentation for details. There are other workarounds, e.g., using 'tre

Re: [R] lattice grayscale "theme"

2007-08-01 Thread Deepayan Sarkar
On 7/30/07, Patrick Drechsler <[EMAIL PROTECTED]> wrote: > "Deepayan Sarkar" <[EMAIL PROTECTED]> writes: > > On 7/30/07, Patrick Drechsler <[EMAIL PROTECTED]> wrote: > >> The Gmane interface seems to have some lag at the moment... > >

Re: [R] line widths of plotting symbols in the lattice

2007-07-31 Thread Deepayan Sarkar
a workaround is to use grid.points directly, e.g. library(grid) xyplot(1:10 ~ 1:10, cex = 2, lwd = 3, panel = function(x, y, ...) grid.points(x, y, gp = gpar(...))) -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] duplicate DATE at in lattice scale handled differently from base graphics OR lattice numeric scales

2007-07-30 Thread Deepayan Sarkar
> 4, 4, 6), labels = letters[1:4])) List of 4 $ at : num [1:3] 13516 13518 13520 $ labels : chr [1:4] "a" "b" "c" "d" $ check.overlap: logi FALSE $ num.limit: num [1:2] 13515 13524 That is, 'at' is now of length 3 (and

Re: [R] lattice grayscale "theme"

2007-07-30 Thread Deepayan Sarkar
On 7/30/07, Patrick Drechsler <[EMAIL PROTECTED]> wrote: > The Gmane interface seems to have some lag at the moment... > > "Deepayan Sarkar" <[EMAIL PROTECTED]> writes: > > > On 7/28/07, Patrick Drechsler <[EMAIL PROTECTED]> wrote: > >&

Re: [R] lattice grayscale "theme"

2007-07-30 Thread Deepayan Sarkar
etween' more precisely. help(trellis.par.set) tells you how to change settings, and you can use it to change all the components you want (and the colors can of course be greyscale). -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.

Re: [R] Overlaying a single contour from a new data array in levelplot

2007-07-30 Thread Deepayan Sarkar
On 7/30/07, Jenny Barnes <[EMAIL PROTECTED]> wrote: > Dear Deepayan > > Thank you for your response - it has proved very very helpful, I can't thank > you > enough! > > I have another question for you if you have time to reply. I know you have > been >

Re: [R] How to auto-scale cex of y-axis labels in lattice dotplot?

2007-07-26 Thread Deepayan Sarkar
ayout[2] * device.aspect / panel.aspect))) n <- ceiling(plots.per.page/m) m <- ceiling(plots.per.page/n) panel.layout[1] <- n panel.layout[2] <- m } -Deepayan __ R-help@stat.math.ethz.ch mailing list htt

Re: [R] Overlaying a single contour from a new data array in levelplot

2007-07-24 Thread Deepayan Sarkar
(172, 182)) levelplot(volcano, add.cl = vcl, panel = function(..., add.cl) { panel.levelplot(...) lapply(add.cl, panel.polygon, border = 'red') }) -Deepayan __ R-help@stat.math.ethz.ch mailing list https://

Re: [R] creating a world map of eco-climatic zones

2007-07-18 Thread Deepayan Sarkar
> coordinates for polygons describing the sub-country portion falling into a > single eco-climatic zone, is there a way to improve the above map to show > portions of countries belonging to a specific eco-climatic zone? wmap$x and wmap$y are exactly that

Re: [R] lattice plot axis scaling

2007-07-18 Thread Deepayan Sarkar
}) > ___ > The problem is that x1 varies from 1-3, while x2 varies from 20-60. The > output scales both independent variables the same, so all the data in > the y vs x1 plot are up against the left edge of the plot. How do I &

Re: [R] xyplot for longitudinal data

2007-07-17 Thread Deepayan Sarkar
p(spcolors[1:nlevels(group)], each = nlevels(subject Look at ?Rows, which might help in getting code that is a bit more general (for instance, the code above may not work when groups has more than 7 levels). -Deepayan __ R-help@stat.math.ethz.ch

Re: [R] Restructuring data

2007-07-15 Thread deepayan . sarkar
7022807 0.19770349 2.A 22 A -0.20672870 1.49590443 3.A 33 A 0.05533779 1.35319133 4.A 44 A -0.11471772 -0.11013896 1.B 11 B 1.09573107 -0.08333043 2.B 22 B 0.07397772 -0.98555020 3.B 33 B 0.25821758 0.16808307 4.B 44 B 1.277

Re: [R] Drawing rectangles in multiple panels

2007-07-14 Thread Deepayan Sarkar
ssary copying, and panel functions only access one data matrix at a time. -Deepayan > --- Deepayan Sarkar <[EMAIL PROTECTED]> wrote: > > > On 7/11/07, hadley wickham <[EMAIL PROTECTED]> wrote: > > > > A question/comment: I have usually found that the subscripts

Re: [R] change default alphabetic order for bwplot

2007-07-13 Thread deepayan . sarkar
lls you how to specify your own levels. -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] Subplot.

2007-07-13 Thread Deepayan Sarkar
ce.part, singer) ## using ggplot2 library(ggplot2) qplot(height, data = singer, geom = "histogram", facets = voice.part ~ .) -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Direction of panel plots in trellis graphics

2007-07-13 Thread deepayan . sarkar
.panel.default(layout = layout, row = column, column = row, ...) }) This effectively transposes the layout, which (along with as.table=TRUE) is what you want. -Deepayan __ R-help@stat.math.ethz.ch m

Re: [R] Drawing rectangles in multiple panels

2007-07-11 Thread Deepayan Sarkar
actually ever does that, but it's the principle of the thing)). This happens transparently if you supply the external data as arguments to xyplot(). It happens in your example too, but the data is hidden inside the environment of the panel function. The two approaches might differ in terms of memory

Re: [R] Drawing rectangles in multiple panels

2007-07-11 Thread Deepayan Sarkar
we have proper multiple dispatch in S4, we can write methods that behave like traditional Trellis calls but work with more complex data structures. We have tried this in one bioconductor package (flowViz) with encouraging results. -Deepayan __ R-help

Re: [R] Drawing rectangles in multiple panels

2007-07-11 Thread deepayan . sarkar
On 7/11/07, Jonathan Williams <[EMAIL PROTECTED]> wrote: > Deepayan, > > Thanks for the clarification. The rectangles are completely external > to the panel data, and correspond to 90% confidence intervals built > from training data, to be overlaid on these graphs of the tes

Re: [R] Drawing rectangles in multiple panels

2007-07-11 Thread deepayan . sarkar
On 7/11/07, Bert Gunter <[EMAIL PROTECTED]> wrote: > Deepayan et. al.: > > A question/comment: I have usually found that the subscripts argument is > what I need when passing *external* information into the panel function, for > example, when I wish to add results from a fit

Re: [R] Drawing rectangles in multiple panels

2007-07-11 Thread deepayan . sarkar
lot(x, y, ...) } xyplot(Sepal.Length ~ Sepal.Width | Species, iris, panel = panel.qrect) If the rectangles are somehow determined externally, you probably want to use one of the accessor functions described in help(panel.number). There are good and bad (i.e. less robust) ways to use these, but w

Re: [R] Formatting panel borders in lattice package

2007-07-10 Thread Deepayan Sarkar
ce.part, singer, par.settings = list(axis.line = list(lwd = 3)), scales = list(lwd = 1)) > 2) Does anybody know of a way to separate panels with whitespace? qqmath(~height | voice.part, singer, between = list(x = 0.5, y = 0.5)) -Deepayan __ R-

Re: [R] Lattice: vertical barchart

2007-07-10 Thread Deepayan Sarkar
the horizontal = FALSE > argument. With a slight modification to barchart.table this can be > accomplished. Thanks Sundar. This seems like a reasonable feature; I'll add it in the next update. -Deepayan __ R-help@stat.math.ethz.ch mailin

Re: [R] Antwort: Re: pgup/pgdown in R Graphics Window under Linux ['Watchdog': checked]

2007-07-09 Thread Deepayan Sarkar
On 7/8/07, Paul Matthias Diderichsen <[EMAIL PROTECTED]> wrote: > Hi Deepayan, > > "Deepayan Sarkar" <[EMAIL PROTECTED]> schrieb am 06.07.2007 > 02:05:02: > > On 7/5/07, Paul Matthias Diderichsen > > <[EMAIL PROTECTED]> wrote: > >> libr

Re: [R] Several quick questions

2007-07-08 Thread deepayan . sarkar
o 7% (I think this value came from Trellis specs, but I don't remember the exact details). > lattice.getOption("axis.padding") $numeric [1] 0.07 $factor [1] 0.6 -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] Changing Tick Mark Values for lattice / wireframe

2007-07-06 Thread Deepayan Sarkar
...) It probably makes sense to allow this for matrices directly, and I'll add something in the next update. -Deepayan > Thanks in advance. > > graphic5 <- wireframe(output.matrix, shade= TRUE, > scales = list(arrows = FALSE, > cex=.6, col="black", font= 3, tck=1

Re: [R] algebra/moving average question - NOTHING TO DO WITH R

2007-07-06 Thread Deepayan Sarkar
tions are correct (they may not be, so you should check), this equation is Ax^2 + Bx + C = 0, where A = (n-1)^3 - Z^2 * n * (n-1) B = -2 * (Z^2 * n + (n-1)^2) * T1(t, n-1) C = (Z^2 * n + n - 1) * T1(t, n-1)^2 - Z^2 * n^2 * T2(t, n-1) Hope this helps, -Deepayan ___

Re: [R] pgup/pgdown in R Graphics Window under Linux

2007-07-05 Thread Deepayan Sarkar
c(3,3)) If this is your use case, you might be interested in http://cran.r-project.org/src/contrib/Descriptions/plotAndPlayGTK.html -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the pos

Re: [R] Adding points to a wireframe with conditioning variable

2007-07-05 Thread Deepayan Sarkar
or order if you think of the conditioning variables as defining a multiway cross-tabulation), and which.packet() will give you a vector with the current level of each conditioning variable. You can use these to extract the appropriate subset of points. -Deepayan

Re: [R] Lookups in R

2007-07-05 Thread deepayan . sarkar
s available in R, e.g. using tapply() in your original question and rowMeans() in this example. Sometimes you cannot, and the only way to gain efficiency is to write custom C code (we do not have enough information to decide which is the case in your real example, since we don't know what it is

Re: [R] Lookups in R

2007-07-04 Thread deepayan . sarkar
:n_accts) > colnames(udf) <- c("amt", "n") > system.time(for (i in seq_along(t$amt)) { + idx <- t$acct[i] + udf[idx, ] <- udf[idx, ] + c(t$amt[i], 1) + }, gcFirst = TRUE) user system elapsed 1.872 0.008 1.883 The loop is still going to be the pro

Re: [R] retrieving stats from bwplot

2007-07-04 Thread deepayan . sarkar
t combinations defined by more than one factor, you could use something like with(OrchardSprays, split(decrease, interaction(treatment, colpos))) (although this is a bad example, since there is only one observation per combination) -Deepayan __ R-help

Re: [R] Lattice: shifting strips to left of axes

2007-07-03 Thread deepayan . sarkar
widths = unit.c(unit1, unit2), respect = TRUE) lab.gf <- frameGrob(layout=lab.layout) for (i in seq_len(nlabs)) { lab.gf <- placeGrob(lab.gf, labs[[i]], row = i, col = 2) } lab.gf <- placeGrob(lab.gf, main.ylab, col = 1) lab.gf }

Re: [R] Lattice: shifting strips to left of axes

2007-07-02 Thread deepayan . sarkar
ree", y = list(draw = FALSE)), axis = function(side, ...) { if (side == "right") panel.axis(side = "right", outside = TRUE) else axis.default(side = side, ...) }, par.settings= lis

Re: [R] Plots from categorial data

2007-07-01 Thread deepayan . sarkar
m=c(0,0.5),main="OCR performance", > xlab="Filter setting",ylab="Average hits",axes=FALSE) > points(as.numeric(krammer$filter_setting[7:12]),krammer$avg_hit[7:12], > type="b",col=3) > points(as.numeric(krammer$filter_setting[13:18]),krammer$a

Re: [R] Changing graphics height when using grid and lattice

2007-06-28 Thread Deepayan Sarkar
ding = list(x = 1, units = "mm", data = NULL), axis.key.padding = list(x = 1, units = "mm", data = NULL), right.padding = list(x = 1, units = "mm", data = NULL)) ) lattice.options(myLatticeOptions()) I'm not particularly attac

Re: [R] Adding different output to different lattice panels

2007-06-28 Thread Deepayan Sarkar
dat<-data.frame(id=rep(c("a","b","c"),4),val=1:12,quand=rep(c("t1","t2","t3","t4"),each=3)) > > > ref<-c(10,8,6) > > > plot.new() > > > datplot<-dotplot(val~quand|id,data=dat,panel=function(...){ > &g

Re: [R] Adding different output to different lattice panels

2007-06-28 Thread deepayan . sarkar
gt; panel.dotplot(...) > panel.abline(h=ref) > }) > print(datplot) dotplot(val~quand|id,data=dat,panel=function(...){ panel.dotplot(...) panel.abline(h = ref[packet.number()]) }) (Things are more complicated if you have more than one conditioning variable.) -Deepayan _

Re: [R] levelplot in lattice

2007-06-27 Thread deepayan . sarkar
On 6/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Sorry. My email editor from my ISP always screws up the text after sending > out. Below is my response to you (in plain text). > > Thank you Deepayan. Let's do the following exercise to reproduce the problem > I&

Re: [R] Sweave bug? when writing figures / deleting variable in chunk

2007-06-27 Thread Deepayan Sarkar
e end of that same chunk > Then the Sweave driver chokes, not finding the variable name when > generating the figure The reason is that by default, every fig=TRUE chunk is run twice, once to produce postscript, once for pdf. -Deepayan __ R-help@

Re: [R] levelplot in lattice

2007-06-27 Thread Deepayan Sarkar
ggest a > way to solve this problem. > It all depends on the details. Please give a small reproducible example. > Also, if I would like to put in mathematical notation on the top strip of the > plot instead of using text in my events factor vector, what can I do? Use expressions

Re: [R] xyplot with par

2007-06-27 Thread deepayan . sarkar
swer didn't > seem to work. > thanks > dave > > x1 = rnorm(10) > x2 = rnorm (10) > y1 = rnorm(10) > y2 = rnorm (10) > op = par(mfrow = c(2,1)) > xyplot(y1 ~ x1) > xyplot(y2 ~ x2) See help(print.trellis), which has examples. -Deepayan _

Re: [R] Lattice: hiding only some strips

2007-06-22 Thread deepayan . sarkar
On 6/22/07, Michael Hoffman <[EMAIL PROTECTED]> wrote: > Deepayan Sarkar wrote: > > On 6/22/07, Michael Hoffman <[EMAIL PROTECTED]> wrote: > >> I am using R 2.4.0 and lattice to produce some xyplots conditioned on a > >> factor and a shingle. The shingle me

Re: [R] Barchart legend position

2007-06-22 Thread Deepayan Sarkar
or(unit = "npc") if (!is.null(ll)) draw.key(simpleKey(dimnames(Titanic)$Survived, rect = TRUE, points = FALSE), vp = viewport(x = ll$x, y = ll$y), draw = TRUE) }

Re: [R] Lattice: hiding only some strips

2007-06-22 Thread Deepayan Sarkar
) strip.default(which.given = 1, which.panel = which.panel[which.given], ...) }) -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Overlaying lattice graphs (continued)

2007-06-22 Thread Deepayan Sarkar
On 6/22/07, Sébastien <[EMAIL PROTECTED]> wrote: > Hi Deepayan, > > The following code creates a dummy dataset which has the same similar as > my usual datasets. I did not try to implement the changes proposed by > Hadley, hoping that a solution can be found using

Re: [R] barchart in trellis and NA

2007-06-21 Thread Deepayan Sarkar
though > it appears in the result of table. Is there a possibility to get this > bar too? Please give a reproducible example, because it's not clear to me what exactly is supposed to be NA. -Deepayan __ R-help@stat.math.ethz.ch mailing list ht

Re: [R] Overlaying lattice graphs (continued)

2007-06-21 Thread Deepayan Sarkar
try out some real code? Just from your description, I would have suggested something like xyplot(Observed + Predicted ~ Time | Individuals + Model, data = mydata, panel = panel.superpose.2, type = c("p", "l"), layout = c(0, nlevels(mydata$Individuals)

Re: [R] Retrieve part of (top right corner) of a "plot.data.frame" plot?

2007-06-20 Thread Deepayan Sarkar
> > Any suggestions you can give (especially any not involving the source code > of 'pairs') are most welcome. Lattice gets you close: xyplot(a + b + c ~ d + e + f, data = x, outer = TRUE, scales = "free", layout = c(3, 3), aspect = 1) The rest may or may not

Re: [R] plotting order of lines in xyplot panels while using conditioning variable and groups

2007-06-19 Thread Deepayan Sarkar
change the order in which curves > are plotted in each panel. I have tried reordering the > levels in data$group: > > data$group<-factor(data$group, > levels=c("CV_model_event_1","CV model event 2","CV > event > 1","CV_event_2","CV_event_

Re: [R] Histograms with strings, grouped by repeat count (w/ data)

2007-06-19 Thread Deepayan Sarkar
le2" "file3" ... ..$ : chr [1:29] "email1" "email10" "email11" "email12" ... You need to read help(Extract) carefully and play around with some simple examples. > I don't understand why that produces

Re: [R] Controlling text and strip arrangement in xyplot

2007-06-19 Thread Deepayan Sarkar
beta)), strip.left = strip.custom(horizontal = FALSE, factor.levels = expression(g[2]==gamma, g[2]==delta))) Otherwise, you will really have to write a proper strip function that calls strip.default() wit

Re: [R] Second y-axis in xyplot (lattice) where y1 and y2 have different ranges

2007-06-18 Thread Deepayan Sarkar
gt; par(new=T) and label axis 4 with standard graphics. I've seen an example > for doing something similar in xyplot even though Deepayan has indicated > that lattice isn't the right tool for the job. > > However, is there a way to gracefully add a second y-axis to a xyplot >

Re: [R] plot via xyplot not being saved

2007-06-15 Thread deepayan . sarkar
10) y <- rnorm(10) x + y x - y } calling test() at the R prompt will only print x - y and not x + y, and so on. This is all standard R behaviour. If you want something to be printed irrespective of context, use print(), e.g. print(x + y) or print(xyplot(y~x|z)) This is also men

Re: [R] plot via xyplot not being saved

2007-06-15 Thread deepayan . sarkar
> z <- sample(letters[1:4], 100, rep=T) > library(lattice) > bitmap("tst.png") > xyplot(y~x|z) > dev.off() > > and I source it, I get the tst.png file, which is a blank page. > > If I copy and paste instead, I get the correct plot. > > Any suggestion?

Re: [R] model.frame: how does one use it?

2007-06-15 Thread Deepayan Sarkar
iginal (R argument semantics are call by value, not call by reference). You are losing data$w in the local copy in your function, but why would you care if you are not using it anyway. Of course, if your formula contains a reference to 'w' then you will get wrong results, so checking for

Re: [R] model.frame: how does one use it?

2007-06-15 Thread Deepayan Sarkar
On 6/15/07, hadley wickham <[EMAIL PROTECTED]> wrote: > On 6/15/07, Deepayan Sarkar <[EMAIL PROTECTED]> wrote: [...] > > By 'name', I mean a symbol, such as 'Age' or 'myweight'. So > > basically, everything is as you would expect if the n

Re: [R] model.frame: how does one use it?

2007-06-15 Thread Deepayan Sarkar
e confusing if it were the other way round). With this in mind, either of the following might do what you want: badFunction <- function(mydata, myformula) { mydata$myweight <- abs(rnorm(nrow(mydata))) hyp <- rpart(myformula, data=

Re: [R] [OT] 'gv' and fractional points

2007-06-15 Thread Deepayan Sarkar
coarse side on other occasions. If you are mostly concerned about small figures, one possibility is 1. zoom out to a level where you're happy with the pixel resolution 2. do a screen capture using 'import' 3. use gimp (which has the same feature, with more units) gim

Re: [R] Annotating trellis graphics

2007-06-14 Thread Deepayan Sarkar
panel.xyplot(x, y, ...) fm <- lm(y ~ x) panel.abline(reg = fm) slope <- round(coef(fm)[2], 3) message("Click on desired location") panel.text(grid.locator("native"), lab = slope) }) -Deepayan _

Re: [R] 2 Trellis graphics question

2007-06-12 Thread Deepayan Sarkar
subset of 'good' relevant for this panel panel.lmline(x[good.id], y[good.id], col = "blue") }) This also works if 'good' is globally visible and not in 'mydata'. [...] > 2) There are 5 dif

Re: [R] Stacked barchart color

2007-06-12 Thread Deepayan Sarkar
ol=c("red","green","blue","gray")) The easiest way is to create a new factor with suitable levels: replace groups=year by groups=year:variety or the more verbose groups=interaction(year, variety) -Deepayan _

Re: [R] format.dates, chron and Hmisc

2007-06-12 Thread Deepayan Sarkar
> Error in pretty(rng, ...) : unused argument(s) (format.posixt = NULL) This one is a bug in lattice (there is some code to support chron objects, but evidently not many people use it). I will include a fix in the next update. -Deepayan __ R-help@

  1   2   3   4   5   6   7   8   9   10   >