An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130501/543aa045/attachment.pl>
Lattice xyplot multipanels
8 messages · Santosh, David Winsemius, Duncan Mackay
On May 1, 2013, at 6:16 PM, Santosh wrote:
Derar Rxperts, I have a strange situation.. I see curly brackets
Wait right here. What do you mean by "brackets"? In some locales, such as mine, that might mean "[" ; in other domains... well, who knows? I don't see any "[". The Urban Legends Newsgroup used to have a saying: TWIAVBP, which is an initialism for: The World Is A Very Big Place. Pleas realize that language is local.
around "strip.levels" in multipanel strips while using lattice::xyplot. .How do I get rid of the curly brackets?
Curly "brackets"? You mean curley braces? I see some of them in the code, but why in the world would one want to remove valid curley-braces in code? They just function as delimiters.
For some reason, I am not able to reproduce the problem using an example below...
What problem? .. are you unable to reproduce? The code runs without error on my machine.
Any suggestions are highly welcome!
Thanks,
Santosh
q <-
data.frame(G=rep(paste("G",1:3,sep=""),each=50),D=rep(paste("D",1:5,sep=""),each=30),a=rep(1:15,each=10),t=rep(seq(10),15),b=round(runif(150,10,20)))
q$grp <- paste(q$D,q$a,sep=":")
q$grp <- ordered(q$grp, levels=unique(q$grp))
q$dcol <- unlist(sapply(q$D,function(x)
switch(x,"D1"="orange","D2"="blue","D3"="red", "D4"="seagreen",
"D5"="black")))
q2 <- q[order(q$G,q$D,q$a,q$t),]
ref3 <- subset(q2, !duplicated(a))
xyplot(b~t|G,data=q2,groups=grp,type="l",as.table=T,
layout=c(3,1), par.strip.text = list(lines = 2),
panel=panel.superpose,
panel.groups=function(x=x,y=y,subscripts=subscripts,groups=groups,...,group.number)
{
require(grid)
panel.xyplot(x=x,y=y,subscripts=subscripts,pch=NA,lwd=1,type="l",
col=q2$dcol[subscripts],lty=1,cex=0.7)
rv0 <-ref3[ref3$G%in%unique(q2$G)[panel.number()],]
tids <- paste(as.character(unique(rv0$D)))
tcols <- unique(rv0$dcol)
tlty <- 1
draw.key(list(columns=1,between=1,between.col=0.5,
text=list(lab=tids,col=tcols,cex=0.8),title="Classes",cex.title=1.1
),
draw = T,vp = viewport(x = unit(0.8, "npc"), y = unit(0.9, "npc")))
},
strip=strip.custom(strip.names=T,strip.levels=T,par.strip.text=list(cex=1.7,font=2),bg=0,
var.name="School"),
xlab=deparse(substitute(x)),
ylab=deparse(substitute(y)),
main="Overlay of Profiles by Schools and Classes",
)
Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.Please stop sending HTML.
[[alternative HTML version deleted]]
And please explain what you want in language that transcends your own keyboard and mental constructs.
David Winsemius Alameda, CA, USA
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130501/67766f3c/attachment.pl>
On May 1, 2013, at 8:16 PM, Santosh wrote:
Sorry about the word "brackets".. Yes, I meant curly braces! I have not heard of "curley braces"! :). Curly braces surrounding the values of "strip.levels" appear on the strip of multipanel plots.
Not in my running of your code.
Thanks, Santosh On Wed, May 1, 2013 at 7:44 PM, David Winsemius <dwinsemius at comcast.net> wrote: On May 1, 2013, at 6:16 PM, Santosh wrote:
Dear Rxperts, I have a strange situation.. I see curly brackets
Wait right here. What do you mean by "brackets"? In some locales, such as mine, that might mean "[" ; in other domains... well, who knows? I don't see any "[". The Urban Legends Newsgroup used to have a saying: TWIAVBP, which is an initialism for: The World Is A Very Big Place. Pleas realize that language is local.
around "strip.levels" in multipanel strips while using lattice::xyplot. .How do I get rid of the curly brackets?
Curly "brackets"? You mean curley braces? I see some of them in the code, but why in the world would one want to remove valid curley-braces in code? They just function as delimiters.
For some reason, I am not able to reproduce the problem using an example below...
What problem? .. are you unable to reproduce? The code runs without error on my machine.
Any suggestions are highly welcome!
Thanks,
Santosh
q <-
data.frame(G=rep(paste("G",1:3,sep=""),each=50),D=rep(paste("D",1:5,sep=""),each=30),a=rep(1:15,each=10),t=rep(seq(10),15),b=round(runif(150,10,20)))
q$grp <- paste(q$D,q$a,sep=":")
q$grp <- ordered(q$grp, levels=unique(q$grp))
q$dcol <- unlist(sapply(q$D,function(x)
switch(x,"D1"="orange","D2"="blue","D3"="red", "D4"="seagreen",
"D5"="black")))
q2 <- q[order(q$G,q$D,q$a,q$t),]
ref3 <- subset(q2, !duplicated(a))
xyplot(b~t|G,data=q2,groups=grp,type="l",as.table=T,
layout=c(3,1), par.strip.text = list(lines = 2),
panel=panel.superpose,
panel.groups=function(x=x,y=y,subscripts=subscripts,groups=groups,...,group.number)
{
require(grid)
panel.xyplot(x=x,y=y,subscripts=subscripts,pch=NA,lwd=1,type="l",
col=q2$dcol[subscripts],lty=1,cex=0.7)
rv0 <-ref3[ref3$G%in%unique(q2$G)[panel.number()],]
tids <- paste(as.character(unique(rv0$D)))
tcols <- unique(rv0$dcol)
tlty <- 1
draw.key(list(columns=1,between=1,between.col=0.5,
text=list(lab=tids,col=tcols,cex=0.8),title="Classes",cex.title=1.1
),
draw = T,vp = viewport(x = unit(0.8, "npc"), y = unit(0.9, "npc")))
},
strip=strip.custom(strip.names=T,strip.levels=T,par.strip.text=list(cex=1.7,font=2),bg=0,
var.name="School"),
xlab=deparse(substitute(x)),
ylab=deparse(substitute(y)),
main="Overlay of Profiles by Schools and Classes",
)
David Winsemius Alameda, CA, USA
Hi Santosh
Try this :
q <-
data.frame(G=rep(paste("G",1:3,sep=""),each=50),
D=rep(paste("D",1:5,sep=""),each=30),
a=rep(1:15,each=10),t=rep(seq(10),15),
b=round(runif(150,10,20)))
q$grp <- paste(q$D,q$a,sep=":")
q$grp <- ordered(q$grp, levels=unique(q$grp))
q$dcol <-
unlist(sapply(q$D,function(x)
switch(x,"D1"="orange","D2"="blue","D3"="red",
"D4"="seagreen", "D5"="black")))
q2 <- q[order(q$G,q$D,q$a,q$t),]
ref3 <- subset(q2, !duplicated(a))
xyplot(b~t|G,data=q2,groups=grp,type="l",as.table=T,
layout=c(3,1), par.strip.text = list(lines = 2),
panel=panel.superpose,
strip=strip.custom(strip.names=T,strip.levels=T,par.strip.text=list(cex=1.7,font=2),bg=0,var.name="School"),
xlab=deparse(substitute(x)),
ylab=deparse(substitute(y)),
main="Overlay of Profiles by Schools and Classes",
panel.groups=function(x=x,y=y,subscripts=subscripts,groups=groups,...,group.number){
require(grid)
panel.xyplot(x=x,y=y,subscripts=subscripts,pch=NA,lwd=1,type="l",
col=q2$dcol[subscripts],lty=1,cex=0.7)
rv0 <-ref3[ref3$G%in%unique(q2$G)[panel.number()],]
tids <- paste(as.character(unique(rv0$D)))
tcols <- unique(rv0$dcol)
tlty <- 1
draw.key(list(columns=1,between=1,between.col=0.5,
text=list(lab=tids,col=tcols,cex=0.8),title="Classes",cex.title=1.1),
draw = T,vp = viewport(x = unit(0.8, "npc"), y
= unit(0.9, "npc")))
}
)
It works for me OK so I do not know what you mean. Version information below
I just rearranged your script - there was an extra "," at the end
before the last ")"
R version 3.0.0 (2013-04-03), i386-w64-mingw32
Base packages: base, datasets, graphics, grDevices, grid, methods,
splines, stats, stats4, utils
Other packages: chron 2.3-43, foreign 0.8-53, lattice 0.20-15,
latticeExtra 0.6-24, MASS 7.3-26,
R.methodsS3 1.4.2, R.oo 1.13.0, RColorBrewer 1.0-5, VGAM 0.9-0, xtable 1.7-1
Duncan
Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au
At 11:16 2/05/2013, you wrote:
Derar Rxperts,
I have a strange situation.. I see curly brackets around "strip.levels" in
multipanel strips while using lattice::xyplot. .How do I get rid of the
curly brackets? For some reason, I am not able to reproduce the problem
using an example below...
Any suggestions are highly welcome!
Thanks,
Santosh
q <-
data.frame(G=rep(paste("G",1:3,sep=""),each=50),D=rep(paste("D",1:5,sep=""),each=30),a=rep(1:15,each=10),t=rep(seq(10),15),b=round(runif(150,10,20)))
q$grp <- paste(q$D,q$a,sep=":")
q$grp <- ordered(q$grp, levels=unique(q$grp))
q$dcol <- unlist(sapply(q$D,function(x)
switch(x,"D1"="orange","D2"="blue","D3"="red", "D4"="seagreen",
"D5"="black")))
q2 <- q[order(q$G,q$D,q$a,q$t),]
ref3 <- subset(q2, !duplicated(a))
xyplot(b~t|G,data=q2,groups=grp,type="l",as.table=T,
layout=c(3,1), par.strip.text = list(lines = 2),
panel=panel.superpose,
panel.groups=function(x=x,y=y,subscripts=subscripts,groups=groups,...,group.number)
{
require(grid)
panel.xyplot(x=x,y=y,subscripts=subscripts,pch=NA,lwd=1,type="l",
col=q2$dcol[subscripts],lty=1,cex=0.7)
rv0 <-ref3[ref3$G%in%unique(q2$G)[panel.number()],]
tids <- paste(as.character(unique(rv0$D)))
tcols <- unique(rv0$dcol)
tlty <- 1
draw.key(list(columns=1,between=1,between.col=0.5,
text=list(lab=tids,col=tcols,cex=0.8),title="Classes",cex.title=1.1
),
draw = T,vp = viewport(x = unit(0.8, "npc"), y = unit(0.9, "npc")))
},
strip=strip.custom(strip.names=T,strip.levels=T,par.strip.text=list(cex=1.7,font=2),bg=0,
var.name="School"),
xlab=deparse(substitute(x)),
ylab=deparse(substitute(y)),
main="Overlay of Profiles by Schools and Classes",
)
[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org 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.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130501/53229dba/attachment.pl>
19 days later
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130521/b770787a/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130521/8e813271/attachment.pl>