[R] lattice legen and auto.key conflict

Bert Gunter gunter.berton at gene.com
Mon Jul 30 18:46:25 CEST 2012


David:

I think one needs to carefully parse the xyplot help, where it says:

"To use more than one legend, or to have arbitrary legends not
constrained by the structure imposed by key, use the legend argument.
"

So I presume that this is to be interpreted as: "ONLY the legend
argument will be used when both key(including auto.key) and legend
arguments are given." However, this is not clear to me either. The
Help appears to leave the behavior when one tries to use both
unspecified.

-- Bert

On Mon, Jul 30, 2012 at 9:10 AM, GOUACHE David
<D.GOUACHE at arvalisinstitutduvegetal.fr> wrote:
> Hello R-helpers,
>
> I'm trying to customize a graphic in lattice using the 'legend' argument to add labels on my plot but in the process I'm losing the legend drawn by 'auto.key', despite the fact that I'm actually not sticking these on the same sides of the graphic. I worked up a quick and simple example with the iris data :
>
> ### here's the basic graph
> xyplot(Sepal.Length+Sepal.Width~Petal.Length+Petal.Width,data=iris,groups=Species,auto.key=list(space="right"))
>
> ### now I try to add a 'legend' argument :
> xyplot(Sepal.Length+Sepal.Width~Petal.Length+Petal.Width,data=iris,groups=Species,auto.key=list(space="right"),legend=list(bottom=list(fun=grid.text,args=list(label="youpi !"))))
>
> ### and sadly the my initial legend has disappeared...
>
>
> Any pointers ?
> Many thanks in advance for your help
>
> David Gouache
> ARVALIS - Institut du Végétal
> Service Génétique Physiologie et Protection des Plantes
> IBP - Université Paris Sud
> Rue de Noetzlin - Bât. 630
> 91405 - ORSAY CEDEX (Adresse Postale)
> 91190 - GIF SUR YVETTE (Adresse GPS, livraison)
> Tél : +33.(0)1.69.93.85.60
> Port : +33.(0)6.86.08.94.32
> Fax : +33.(0)1.69.93.85.69
>
>
>         [[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.
>



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list