[R] Superscripts and subscripts in trellis graphics

Steve_Friedman at nps.gov Steve_Friedman at nps.gov
Mon May 18 20:42:39 CEST 2009


Gabor's solution has worked very nicely.

Thank you very much.

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


                                                                           
             Gabor                                                         
             Grothendieck                                                  
             <ggrothendieck at gm                                          To 
             ail.com>                  Steve_Friedman at nps.gov              
                                                                        cc 
             05/18/2009 10:45          r-help at r-project.org                
             AM AST                                                Subject 
                                       Re: [R] Superscripts and subscripts 
                                       in trellis graphics                 
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Try:

R2 <- -0.18
panel.text(label = bquote(R^2 == .(R2)), ...


On Mon, May 18, 2009 at 10:25 AM,  <Steve_Friedman at nps.gov> wrote:
>
> I'd like to annotate an xyplot with an R^2 value, but can not find the
> syntax to define the superscript format for the text.
>
> I'd appreciate suggestions,
>
> xyplot(SharkSloughEggs.df$Sharkeggs.rel +
> SharkSloughEggs.df$SharkHatched.rel + SharkSloughEggs.df$SharkFlooded.rel
+
> HSI.shark$MEAN ~ Year,
>           pch=c(1,9,5,4), lty=c(1,6,3,4), lwd = c(2), col = c("black",
> "blue", "green", "red"),
>           scales=list(tick.number=length(Year)), data=SharkSloughEggs.df,
> ylab="Relative Egg Success",
>           main="Shark Slough Alligators",
>           par.settings = graph.sets,  type = "b")
>                 trellis.focus()
>                    panel.text(x=1999, y = 0.95, labels="Hatched Eggs\nR^2
> = -0.18", cex = 0.75)
>                    panel.text(x=1998, y = 0.35, labels="Number of
> Eggs\nR^2 = 0.43",cex = 0.75)
>                    panel.text(x=1995, y = 0.25, labels="Flooded Eggs\nR^2
> = -0.50", cex = 0.75)
>                    panel.text(x=1986, y = 0.3, labels="Mean HSI", cex =
> 0.75)
>                 trellis.unfocus()
>
>
> 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
>
> ______________________________________________
> 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