Re: [R] Simple lattice question

From: Rubén Roa <rroa_at_azti.es>
Date: Thu, 31 Mar 2011 15:58:01 +0200

Thanks Peters!

Just a few minor glitches now:

require(lattice)

data <- data.frame(SP=sort(rep(as.factor(c('A','B','C','D','E')),12)),
                   x=rpois(60,10),
                   y=rep(c(rep(0,4),rep(10,4),rep(20,4)),5),
                   z=rep(1:4,15))
xyplot(x~y|SP,data=data,groups=z,layout=c(2,3),pch=1:4,lty=1:4,col='black',type='b',
       key=list(x = .65, y = .75, corner = c(0, 0), points=TRUE,
                  lines=TRUE, pch=1:4, lty=1:4, type='b',
                  text=list(lab = as.character(unique(data$z)))))

I have an extra column of symbols on the legend,

and,

would like to add a title to the legend. Such as 'main' for plots.

Any suggestions?

Rubén


Dr. Rubén Roa-Ureta
AZTI - Tecnalia / Marine Research Unit
Txatxarramendi Ugartea z/g
48395 Sukarrieta (Bizkaia)
SPAIN
> -----Mensaje original-----
> De: Peter Ehlers [mailto:ehlers_at_ucalgary.ca]
> Enviado el: jueves, 31 de marzo de 2011 15:41
> Para: Rubén Roa
> CC: r-help_at_r-project.org
> Asunto: Re: [R] Simple lattice question
>
> On 2011-03-31 03:39, Rubén Roa wrote:
> >
> > DeaR ComRades,
> >
> > require(lattice)
> > data<-
> data.frame(SP=sort(rep(as.factor(c('A','B','C','D','E')),12)),
> > x=rpois(60,10),
> > y=rep(c(rep(0,4),rep(10,4),rep(20,4)),5),
> > z=rep(1:4,15))
> >
> xyplot(x~y|SP,data=data,groups=z,layout=c(2,3),pch=1:4,lty=1:4,col='bl
> > ack',type='b')
> >
> > How do I put a legend for the grouping variable in the
> empty upper-right panel?
>
> See the help page for xyplot for an example using the iris data.
> You just need to add something like
>
> auto.key = list(x = .6, y = .7, corner = c(0, 0))
>
> to your lattice call. See the 'key' entry on the ?xyplot page.
>
> Peter Ehlers
>
> >
> > TIA
> >
> > Rubén
> >
> >
> ______________________________________________________________________
> > ______________
> >
> > Dr. Rubén Roa-Ureta
> > AZTI - Tecnalia / Marine Research Unit Txatxarramendi Ugartea z/g
> > 48395 Sukarrieta (Bizkaia)
> > SPAIN
> >
> > ______________________________________________
> > 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.
>
>



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. Received on Thu 31 Mar 2011 - 14:00:46 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 31 Mar 2011 - 16:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive