[R] Displaying data in Trellis
ilai
keren at math.montana.edu
Wed Apr 18 18:28:21 CEST 2012
On Wed, Apr 18, 2012 at 8:45 AM, slavrenz <stevelavrenz at hotmail.com> wrote:
I would like to display with the xyplot() function
> for several states. I will have a total of 6 plots, I need to plot the
> points of one of the states in a different color than all the rest, such
> that they can be more easily referenced in a presentation. Does anyone know
> what I can use for this. I'm guessing that I will have to write my own panel
> function,
You guessed wrong... One way is
xyplot(rnorm(60)~runif(60)|gl(6,10),groups=c(rep(1,30),rep(2,10),rep(1,20)))
Or even as a panel function it is rather simple
xyplot(rnorm(60)~runif(60)|gl(6,10),
panel=function(x,y,...){
mycols <- trellis.par.get('superpose.symbol')$col
whichpan <- 1+(packet.number()==4)
panel.xyplot(x,y,col=mycols[whichpan],...)
}
)
Working through the examples in xyplot and applying a little brain you
should have been able to come up with a way that best fits your
situation. If for some reason you do get stuck in the future, please
post a reproducible example. BTW, if this is for your own
dissertation/presentation - why "can't be changed ? " shouldn't you be
more worried about presenting a "non suitable plot" than it's colors ?
Cheers
> View this message in context: http://r.789695.n4.nabble.com/Displaying-data-in-Trellis-tp4567920p4567920.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
More information about the R-help
mailing list