[Rd] Proposed (minor) change to plot.TukeyHSD

Fernando Henrique Ferraz P. da Rosa mentus at gmx.de
Fri Aug 20 19:11:04 CEST 2004


        Attached follows a patch to a minor change in the plot method of
the TukeyHSD class (package stats). Basically it defines main= and xlab=
as formal arguments of the plot function, with reasonable default
values, passing them to title(), instead of using hard-coded only values
for main= and xlab=. This way it's possible to change the title and xlab
of the plots created using plot.TukeyHSD(). It's a minor change but it's
useful when one has to display a plot's title/captions in other language
than english. 

        Thank you,

--
Fernando Henrique Ferraz P. da Rosa
http://www.ime.usp.br/~feferraz
-------------- next part --------------
--- current/TukeyHSD.R	2004-08-20 13:53:12.000000000 -0300
+++ proposed/TukeyHSD.R	2004-08-20 13:57:46.000000000 -0300
@@ -75,7 +75,9 @@
     print.default(unclass(x), ...)
 }
 
-plot.TukeyHSD <- function (x, ...)
+plot.TukeyHSD <- function (x,main = paste(format(100 * attr(x, "conf.level"),2),
+  "% family-wise confidence level\n", sep = ""),
+  xlab = paste("Differences in mean levels of", names(x)[i]), ...)
 {
     for (i in seq(along = x)) {
         xi <- x[[i]]
@@ -90,9 +92,7 @@
         segments(xi[, "lwr"], yvals, xi[, "upr"], yvals, ...)
         segments(as.vector(xi), rep.int(yvals - 0.1, 3), as.vector(xi),
                  rep.int(yvals + 0.1, 3), ...)
-        title(main = paste(format(100 * attr(x, "conf.level"),
-              2), "% family-wise confidence level\n", sep = ""),
-              xlab = paste("Differences in mean levels of", names(x)[i]))
+        title(main = main,xlab = xlab)
         box()
     }
 }


More information about the R-devel mailing list