search for: mypanel

Displaying 20 results from an estimated 34 matches for "mypanel".

2012 Mar 01
2
How to colorize the panel backgrounds of pairs()?
Dear expeRts, I would like to colorize the backgrounds of a pairs plot according to the respective panel number. Here is what I tried (without success): count <- 0 mypanel <- function(x, y, ...){ count <<- count+1 bg. <- if(count %in% c(1,4,9,12)) "#FDFF65" else NA points(x, y, cex=0.5, bg=bg) } U <- matrix(runif(4*500), ncol=4) pairs(U, panel=mypanel) I also tried to set par(bg=bg.) before the call to points(), but that didn...
2007 Oct 19
1
Using grid graphics (hexbin) in pairs() plot problem
Hi, I am trying to create a plot with pairs() using a gplot.hexbin() for each pair. For pairs I can provide a custom upperPanel function: pairs(iris[1:4], panel=mypanel) and mypanel() calls plot.hexbin(): library(hexbin) # Bioconductor mypanel <- function(x, ...){ hb <- hexbin(x) plot(hb) } The problem is that gplot.hexbin() is based on the grid-graphics, and each hexplot goes over my complete graphics device. I suspect that I...
2008 May 30
1
Question about adding text to xYplot(Hmisc)
Hello, I have been trying to make a graph that have error bars and text at specific position. I used the following code from the help file of xYplot(Hmisc) as an example except I add a myPanel function, which is just supposed to add letters from the alphabet at the position aligned at y = 3. It constantly gives me error: "Error using packet 1 argument "subscripts" is missing, with no default". The same code can work with xyplot from the lattice package (does not...
2011 Aug 20
1
Groups and bwplot
...hese issues: require(lattice) mybwplot <- function(x,y,data,groups){ if (missing(groups)||is.null(groups)) { groups <- NULL ngroups <- 1 } else { data[[groups]] <- as.factor(data[[groups]]) ngroups <- nlevels(data[[groups]]) } mywidth <- 1/(ngroups+1) mypanel <- function(x,y,groups,...){ if (missing(groups)||is.null(groups)) { panel.bwplot(x,y,...) } else { panel.superpose(x,y,...) } } mypanel.groups <- function(x,y,groups,ngroups,...){ if (missing(groups)||is.null(groups)){ NULL } else { function(x...
2010 Mar 05
4
conditioning variable in panel.xyplot?
...# Create dataframe "d", with 12 x-y coordinates for each site q <- data.frame(site = c(rep("A",7), rep("B",7)), x=rnorm(14),y=rnorm(14)) # Create dataframe "q", with 7 pairs of x-y coordinates for each site. mypanel <- function(...){ panel.xyplot(q$x, q$y, col="red") # Statement that needs a "Site" conditioning variable panel.xyplot(...)} xyplot(y~x|site, d, panel=mypanel) # Statement erroneously plots all 14 x-y points in "q" on panels f...
2010 Jan 24
1
lattice ltext
...:20 for each panel instead of respecting my desires to have 1:20 and then 21:40. I'm on windows vista, R2.9.2 Best wishes Troels score <- runif(120,0,100) pt <- gl(40,3,120) times <- rep(c(0,3,6),40) trt <- gl(2,60,120) ach <- data.frame(score=score,pt=pt,times=times,trt=trt) myPanel <- function(x,y,...){ panel.xyplot(x,y,...) ltext(x-.1,y+1,paste(pt),cex=0.5) } xyplot(score~times|trt,groups=pt,type=c("p","l"),ach, panel=myPanel) -- Troels Ring Department of nephrology Aalborg Hospital M?lleparkvej phone: +4599326629 Heliosvej 12 9210 Aalborg S? 9814...
2011 Jan 21
1
Help for lattice. par(new=TRUE)
Hi list, I want to plot two plot in the same figure. I set par(new=TRUE). But it does not work. library(lattice) myPanel <- function(x,...) { panel.histogram(x,alpha=0.4,...) ltext(0.4,1.5,paste("Mean=","0.05",digit=2)),cex=0.8) ltext(0.8,1.5,paste("s.d.=","0.06",digit=2)),cex=0.8) } histogram(sh2, type="percent",panel=myPanel,breaks=seq(0,1,by...
2005 Mar 17
1
Varying grid.rect in different panels of a Lattice plot
...;,7), rep("Y",4), rep("N",8), rep("Y",5), "N") Catch <- rpois(26, 30) # fake data Plotdate <- rep(seq(as.Date("2000/10/1"), by="month", length=13),2) trellis.device(theme=col.whitebg()) # panel function that doesn't quite work myPanel <- function(x, y, ...) { grid.rect(x=unit(Plotdate[Spawning == "Y"], "native"), just="left", width=unit(31, "native"), # a bit of a fudge gp=gpar(col="transparent", fill="light grey")) panel.xyplot(x, y, ...)} xy...
2010 Apr 06
1
lattice package: line end style
First, apologies for no example data but I don't think it's needed in this case, Q: Can (and if so how ) the line end style be changed for 'cloud' plots? I've tried par(lend=2), trellis.par.set(add.line = list(lend=2)) and much googling but to no avail Thanks in advance Dan P.S. the reason for this is that the round end looks bad at lwd=3 or more Daniel Alcock Malaria
2008 Mar 27
1
panel function question
I have two data sets with locations, X, Y of houses (df.house) and habitats(df.habitat), respectively. In each dataset, there are 3 replicates (Repeat). Because each replicate has different locations of houses and habitats, I would like to plot them in panels. I wrote something like this: mypanel<-function(x,y,subscripts,...){ panel.xyplot(x,y,pch=20) panel.xyplot( df.habitat$X[subscripts], df.habitat$Y[subscripts], pch=3) } with(df.house, xyplot(X~Y|Repeat, panel=mypanel, subscripts=T)) But the problem is that all habitats from 3 replicates are ended in one panel. Any...
2011 Sep 09
1
Adding groups to regression line panel function in Lattice
..., each=10), cc = rep(seq(10,100, 10),6)) # create data frame with group identifier 'q', independent variable cc d$ba = d$q*0.1*d$cc + 5*rnorm(nrow(d)) # create dependent variable 'ba' mypanel <- function(...){ # panel function panel.lmline(d$cc, d$ba, groups = d$q) # panel.xyplot(....
2012 Mar 10
1
Use different panel functions with lattice
Hi, I have a data.frame df with names(df) = c("Var1", "Var2", "Var3", "Var4") and I plot data with xyplot(Var1+Var2~Var3|Var4, data=df) I want to use different panel functions for Var1 and Var2. How can I do ? Something like : panel.mypanel = function(x, y, ...) { if (Var1) panel.Var1Panel(x, y, ...) else panel.Var2Panel(x, y, ...) } xyplot(Var1+Var2~Var3|Var4, data=df, panel=panel.mypanel) (I have search with google, but I found nothing) Thanks
2009 Mar 23
1
using xyplot
Dear R-sians! I am trying generate a bunch of xyplots library(lattice) myPanel <- function(x,y,xl=range(x),yl=range(y),...) { panel.xyplot(x,y, pch=20,col='blue',cex=0.7,xlim=xl,ylim=yl,...) panel.abline(v=0, col='gray30',lty=2,lwd=1.5,...) panel.loess(x,y, span=2/3,family='gaussian',normalize=T,col='red',lwd=1.5,...) #...
2009 Nov 26
1
lattice --- different properties of lines corresponding to type=c("l", "a") respectively
...uot;) hoping this would be interpreteded parallely to the type= argument, but no. Like: xyplot(response ~ time|group, repa0, groups=~Participant, type=c("b", "a"), lwd=c(1, 3), ylim=c(0, 10)) and many other variants ... Then I vent for writing my own panel functions: mypanel <- function(x, y, ..., type){ panel.average(x, y, ..., horizontal=FALSE) panel.xyplot(x, y, ..., type=type) } xyplot(response ~ time|group, repa0, groups=~Participant, type="l", ylim=c(0, 10), panel=panel.superpose, panel.groups=mypanel) (which doesn't work) ???...
2010 Jan 15
1
Lattice: How to color the data points in splom() according to the panel they are plotted?
Dear ExpeRts, I have the scatter plot matrix as given below. I would like the different "sub-plots" in the scatter plot matrix to be colored differently. How do I get all points shown in the upper-left plot (on position (1,1) in the scatter plot matrix) to be plotted in blue, and the points shown in the plot to the right (on position (1,2) in the scatter plot matrix) to be plotted in
2013 May 15
2
animating plots over time with a slider
I have a population of subjects each with a variable which has been captured at a baseline date. Then for many subjects (but not all) an intervention has occurred and the variable has changed at one or more time points after the baseline date. So my dataset consists of a subject ID (x), which may appear several times or just once, a measure (y), and a date of observation (z). I would like to be
2012 Jan 21
0
How to access the panel rows/columns in pairs()?
Hi, I would like to colorize certain panels in the pairs plot below with certain colors. How can access the panel row and column in a pairs plot to achieve this? Cheers, Marius ## generate data U <- matrix(runif(4000), ncol=4) ## define panel function for colorizing the panels mypanel <- function(x, y, ...){ points(x, y, cex=0.5, col="blue") # giving every panel the same color is easy; how can I get different colors for different panels, say, gray for the (2,3)-panel? } ## scatter plot matrix pairs(U, panel=mypanel)
2012 Mar 29
1
How to access value of the conditioning variable in my panel
Hi, I have 10 panels in the "mypanel" function of my xyplot based on the conditioning variable and I want to print those ten values, panel headings, groups, .. whatever you want to call them. Easiest way please! Fayez [[alternative HTML version deleted]]
2003 Nov 25
1
Does wxRuby have event masks or something similar?
I''m trying to capture character events on a frame, using the following piece of code (adapted from samples/etc/test.rb): def initialize(title) super(nil, -1, title, Wx::Point.new(-1,-1), Wx::Size.new(530,590), Wx::DEFAULT_FRAME_STYLE | Wx::FRAME_SHAPED) evt_paint { onPaint } evt_char { | evt | puts "Got char evt: "+evt.to_s if evt.get_key_code.chr =~
2010 Jan 26
0
create custom function to annotate a levelplot
...update(trellis.last.object(), strip=mystrip) #---------------------------------------- And then everything started going crazy!!! I would also like to add to each panel, as text, the validation value for each prediction. So I tried something like this #----------------------------------------- mypanel = function(x,y,z,subscripts,...){ panel.levelplot(x,y,z,subscripts,...) ltext(150000, 1600000, labels=paste("AUC =", var[subscripts], sep=" "), cex=.7)} update(trellis.last.object(), panel=mypanel) # -------------------------------------- but it displays only the value for t...