Skip to content
Back to formatted view

Raw Message

Message-ID: <1318588672.3027.12.camel@kenneth-desktop>
Date: 2011-10-14T10:37:52Z
From: Kenneth Cabrera
Subject: Legend symbols (line, points) in one column.
In-Reply-To: <626A1678-015A-4323-9738-7F4E1F862D27@comcast.net>

Hi David:

Thank you for your answer.

El vie, 14-10-2011 a las 00:32 -0400, David Winsemius escribi?:
> Legends are built in columns. You need to find a graphics symbol to  
> put in the "points" column or you need to find something that the  
> lines paramater will turn into a dot (and I'm not sure what that might  
> be.) My suggestion would be to change the line type to dashed and use  
> " - - -" for the pch argument.

No, because I want a continous line for the model.
But the data as points, and in the legend to identify each one
as the example shows but in only in one column in the legend!.

> 
> This is what I came up with using the panel.lmline rather than  
> building it outside the plotting function:

If the model is a linear one, it is fine, but the model could 
be a complex one that it is not programmed as "panel.xxmodel", or else.

Thank you very much for your interest in finding the solution.


> x<-1:5
> y<-1*x+rnorm(10)
> data1<-data.frame(x,y,type=rep("data",length(x)))
> 
> require(lattice)
> 
> xyplot(y~x,group=type,
>       type=c("p","l"), lty=3, lwd=2, cex=4,
>       key=list(space="right",text=list(c("Data","Model")),
>             points=list(pch = c(".", "-"),cex=c(4,1.5))  ),
>       par.settings=confMisc1,
>       panel=function(x,y,...){panel.xyplot(x,y,...)
>                   panel.lmline(x,y,...)},
>       distribute.type=TRUE,
>       data=data1)
>