On Sat, Jan 30, 2010 at 12:45 PM, Jonathan Greenberg
<greenb...@ucdavis.edu> wrote:
> Rhelpers:
>
>   Having a problem solving this.  I have an xyplot call that looks like
> this:
>
>
> print(xyplot(temp_species_EAM_Pred_Pop$x+temp_species_NULL_Pred_Pop$x~temp_species_EAM_Pred_Pop$Action,main=current_species,
>                       xlab="Action",ylab="Predicted Pop",
>                       xlim=c(xmin,xmax),ylim=c(ymin,ymax),
>                       auto.key=list(corner=c(1,1))))
>
> This is just a scatterplot with two response variables sharing the same
> predictor variable (temp_species_EAM_Pred_Pop$Action).  Right now, the key
> has the words "temp_species_EAM_Pred_Pop$x" and
> "temp_species_NULL_Pred_Pop$x" next to their symbols.  I would like to
> rename these in the key, say "EAM" and "NULL" -- using the group= command
> doesn't work (since these aren't really different groups).  What is the
> right way to rename these variables in the key?  Is using auto.key the right
> approach?
>
> Thanks!
>
> --j
>

Hi Jonathan,

A couple pointers that can make things simpler when working with
lattice graphics:

1. put your data into 'long format': x, y, group <--- the reshape
package is good for this.

2. use the formula interface to lattice plotting functions:

xyplot(y_var ~ x_var | panel_grouping_var, groups=color_grouping_var,
data=your_dataframe, ...)


Cheers,
Dylan

______________________________________________
R-help@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.

Reply via email to