Skip to content

setting key boxes in xyplot

3 messages · Steve_Friedman at nps.gov, David Winsemius, Deepayan Sarkar

#
David and the list

Yes the graph is produced with the code I submitted. However, I was not
clear in my initial post. and it is totally my mistake for taking up
everyone's valuable time.

My main question focuses on the key which prints in black as opposed to
using the colors ("black", "red" and "green").  The second question
pertains to the use of superscripts.  I'd like the R^2 values to actually
use a exponent.

Because the plot actually plots, there is no error message reported. I'm
interested in getting the call statement to work as intended.

Again, my apologies for being unclear in my first posting,  this list is a
great resources and I learn from everyone daily.

Thanks
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


                                                                           
             David Winsemius                                               
             <dwinsemius at comca                                             
             st.net>                                                    To 
                                       Steve_Friedman at nps.gov              
             04/30/2009 06:34                                           cc 
             PM AST                    r-help at r-project.org                
                                                                   Subject 
                                       Re: [R] setting key boxes in xyplot
On Apr 30, 2009, at 10:35 AM, Steve_Friedman at nps.gov wrote:
It runs without error on my machine ... after loading lattice. Perhaps
you ought to provide the error message .... and the other usual needed
information. See that nice compact but very imformative message at the
bottom of this reply.

--
David

David Winsemius, MD
Heritage Laboratories
West Hartford, CT
#
On May 1, 2009, at 8:51 AM, Steve_Friedman at nps.gov wrote:

            
This gives you at least part of what I imagine you may want:

xyplot(Eggs.p + Fail.p + Mean ~ Year , data = eggs, cex = 0.8, pch =  
c(2, 5),
        panel = panel.superpose.2, main = "Alligator Nest Fate",
        ylab = "Prop. of Total Number of Hatched Eggs \n Prop. of
Total
Flooded Eggs",
        legend = list(right = list(fun = grid::textGrob("Mean HSI",
                                 rot=90))), col=(1:3),
# I have not figured out what that legend is supposed to be doing.

         type = c("b", "b", "h"),

# I find that plotting with the "h" options obscures the meaning.
# But it's your plot.

        key = list(text = list(c(
                 expression("Proportion Hatched "~R^2~" = 0.13"),
                 expression("Proportion Flooded "~R^2~" = -0.23"),
                 expression("Mean HSI"))),
        col = c("black","red", "green")), columns = 3)
I see no call statement.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
5 days later
#
On Fri, May 1, 2009 at 6:28 AM, David Winsemius <dwinsemius at comcast.net> wrote:
And a minor modification, in case the intention was to associate the
colors with lines:



xyplot(Eggs.p + Fail.p + Mean ~ Year , data = eggs, cex = 0.8, pch = c(2, 5),
       panel = panel.superpose.2, main = "Alligator Nest Fate",
       ylab = "Prop. of Total Number of Hatched Eggs \n Prop. of Total
Flooded Eggs",
       legend = list(right = list(fun = grid::textGrob("Mean HSI", rot=90))),
       type = c("b", "b", "h"),
       col = c("black","red", "green"),
       key =
       list(text = list(expression("Proportion Hatched "~R^2~" = 0.13",
                                   "Proportion Flooded "~R^2~" = -0.23",
                                   "Mean HSI")),
            lines = list(col = c("black","red", "green")),
            columns = 1))

-Deepayan