Re: [R] Using auto.key with two variable plots

2010-01-30 Thread Chuck Cleland
On 1/30/2010 3:45 PM, Jonathan Greenberg 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?

  Did you try setting the text parameter of the auto.key list?
Something 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(text=c('EAM','NULL'), corner=c(1,1

> Thanks!
> 
> --j

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
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.


Re: [R] Using auto.key with two variable plots

2010-01-30 Thread Dylan Beaudette
On Sat, Jan 30, 2010 at 12:45 PM, Jonathan Greenberg
 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.


[R] Using auto.key with two variable plots

2010-01-30 Thread Jonathan Greenberg

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

--

Jonathan A. Greenberg, PhD
Postdoctoral Scholar
Center for Spatial Technologies and Remote Sensing (CSTARS)
University of California, Davis
One Shields Avenue
The Barn, Room 250N
Davis, CA 95616
Phone: 415-763-5476
AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307

__
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.