[R] setting trellis auto.key color values

Steve_Friedman at nps.gov Steve_Friedman at nps.gov
Tue May 5 18:38:56 CEST 2009


Sundar,

Thanks for the assistance.

Much appreciated.

Steve



Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

Steve_Friedman at nps.gov
Office (305) 224 - 4282
Fax     (305) 224 - 4147


                                                                           
             Sundar Dorai-Raj                                              
             <sdorairaj at gmail.                                             
             com>                                                       To 
                                       Steve_Friedman at nps.gov              
             05/05/2009 09:08                                           cc 
             AM MST                    r-help at r-project.org                
                                                                   Subject 
                                       Re: [R] setting trellis auto.key    
                                       color values                        
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Set the colors in graph.sets and not auto.key.

graph.sets <- list(axis.text = list(cex = 0.65),
              par.ylab.text = list(cex = 1.25),
              par.xlab.text = list(cex = 1.25),
              superpose.polygon = list(col = 3:5))

Then remove the "col = 3:5" from auto.key and barchart.

Also, you can simplify your code by removing "gator_IR$" and including
"data = gator_IR". I.e.

 barchart(MEAN ~ Hydro | as.factor(IR_ID),
                 data = gator_IR, layout = c(4, 1),
                 groups = Rain, ylim = c(0, 1), ...)

HTH,

--sundar

On Tue, May 5, 2009 at 8:32 AM,  <Steve_Friedman at nps.gov> wrote:
>
>
> I'm working with Lattice graphics and I would like very much to color
code
> the auto.key fill color with the same corresponding colors that I use in
> the panels.  I've looked on the web for clues, and on the CRAN-R help
sites
> searching on "trellis auto.key color" and variations, unfortunately the
> responses there are not very specific.
>
>  Would someone please explain   I have the Book, if you can point me to
the
> pages that explain this I'd appreciate that too
>
>
>
>> graph.sets <- list(axis.text = list(cex = 0.65),
>              par.ylab.text = list(cex = 1.25),
>              par.xlab.text = list(cex = 1.25))
>
>
>>   barchart(gator_IR$MEAN ~ gator_IR$Hydro |
> as.factor(gator_IR$IR_ID),layout=c(4,1),col = c(3:5),
>                 groups=gator_IR$Rain, ylim=c(0,1), par.settings =
> graph.sets,
>                 main = "Alligator Nesting Performance", ylab= "Mean HSI",
>                 auto.key = list("top", columns=3, col=c(3:5))
>
>
> this script creates the graph nicely, with the qualification that the
color
> for the key titles are the correct, but the filling colors are default
> pastels.  Where do I change them ?
>
>
> Windows XP  with R 2.8.1
>
> Thank you.
>
> Steve
>
> Steve Friedman Ph. D.
> Spatial Statistical Analyst
> Everglades and Dry Tortugas National Park
> 950 N Krome Ave (3rd Floor)
> Homestead, Florida 33034
>
> Steve_Friedman at nps.gov
> Office (305) 224 - 4282
> Fax     (305) 224 - 4147
>
> ______________________________________________
> 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.
>




More information about the R-help mailing list