Thank you _very much_ Ilai for the rapid and accurate answer.

It works and indeed helps a lot. Both to solve the question and to help 
me progress !
Possibly this will also help others.

Thanks again

Tito

Le 27/01/2013 01:11, ilai a écrit :
>
>
> On Sat, Jan 26, 2013 at 10:26 AM, Tito de Morais Luis 
> <Luis.Tito-de-Morais@ird.fr <mailto:Luis.Tito-de-Morais@ird.fr>> wrote:
>
>     Hi listers,
>
>     I want to make lattice plots xyplots with the indication of legends
>     inside each panel with only the points and the lines actually ploted
>     inside each given panel according to the group(ing) factor.
>
>     The code below shows what I have achieved so far and I hope will make
>     clear what I want to have.
>     It seems to me that my solution is a very "dirty hack" and there
>     certainly is a much simple and "clean" way to do it.
>     Besides, there is no concordance in lty and pch between the legend
>     above
>     the graph with those inside the panels.
>
> No. Look again. It is your panel legends that don't correspond to the 
> actual plot. The plot symbols and line types for the chosen theme != 
> pch[1:10] and lty[1:10]. You can either explicitly set the pch and lty 
> in the plot and auto.key to be 1:10 and proceed with trellis.focus or 
> insert draw.key in the panel function to automate the procedure and 
> query the groups and graphical parameters of each panel :
>
> xyplot(lbt ~ de | type, data=dataf, groups =sta,
>  type=c("p","g","r"), layout=c(4,1), par.settings = 
> standard.theme(color = FALSE),
>  auto.key=list(space="top", columns=5, lines=TRUE),
>  panel=function(x,y,groups,subscripts,...){
>   panel.xyplot(x,y,groups=groups,subscripts=subscripts,...)
>   pug <- levels(groups)[levels(groups)%in%groups[subscripts]]
>   draw.key(key=list(text = list(as.character(pug)),
>                     lines = list(lty = 
> rep(trellis.par.get('superpose.line')$lty,10)[as.numeric(pug)]),
>                     points = list(pch = 
> rep(trellis.par.get('superpose.symbol')$pch,10)[as.numeric(pug)])
>            ),
>            draw=TRUE , vp=viewport(x=0.25,y=0.9))
> })
>
> HTH
> (...snip...)

-- 
Luis Tito de Morais
IRD - UMR LEMAR (IRD/UBO/CNRS/IFREMER)


	[[alternative HTML version deleted]]

