briandk / granovaGG

Bob Pruzek and Jim Helmreich's implementation of Elemental Graphics for Analysis of Variance
Other
15 stars 4 forks source link

Should users be able to set NULL values for plot labels? #133

Closed briandk closed 12 years ago

briandk commented 13 years ago

@rmpruzek writes:

The one thing that caused me some consternation concerned changing of the main title and the name for the response. I got these to work after some study, and trials, like this: =====>

rat.1wgg=granovagg.1w(rat[,1],jj=.6,resid=T,group=rep(1:6,ea=10),main="One-way ANOVA display showing weight-gains for six groups of rats",ylab="Weight gains of rats in grams") Below are by-group summary statistics of your input data -- these are ok, so I exclude numerics here... group group.mean trimmed.mean contrast variance standard.deviation group.size rat.1wgg+title(main="",ylab="") =====> The resulting graphic is fine w/ this approach. Is this what you would recommend?

The man page for granova.1w shows that the classic granova functions had NULL default values for many parameters, including main, xlab, and ylab

granova.1w(data, group = NULL, dg = 2, h.rng = 1.25, v.rng = 0.2, 
   box = FALSE, jj = 1, kx = 1, px = 1, size.line = -2.5, 
   top.dot = 0.15, trmean = FALSE, resid = FALSE, dosqrs = TRUE, 
   ident = FALSE, pt.lab = NULL, xlab = NULL, ylab = NULL, 
   main = NULL, ...)

-- From the granova.1w help file

Despite those label defaults being NULL, granova.1w forces its own default titles onto the plot:

> library(granova)
> data(anorexia.sub)
> astack <- stack(anorexia.sub)
> with(astack, granova.1w(values, 
                          group = ind, 
                          main  = NULL, 
                          xlab  = NULL, 
                          ylab  = NULL
               )
  )

produces this:

granova.1w plot where default labels have been enforced

I've included patches in this pull that force granovagg.1w to respect NULL values when the user passes them in:

> library(granova)
> data(anorexia.sub)
> astack <- stack(anorexia.sub)
> with(astack, granovagg.1w(values, 
                            group = ind, 
                            main  = NULL, 
                            ylab  = NULL, 
                            xlab  = NULL
               )
  )

produces this:

granovagg.1w plot without labels

/cc @WilDoane

rmpruzek commented 12 years ago

I do not favor the untitled graphic, the last one, for anything. Using the granova.1w model for this, using generic titles, as in the penultimate graphic, is clearly more informative. (And since users can always modify code that comes w/ a downloaded package, were there to be some value in the latter, untitled, plot, they could make the changes rather easily.) Thanks, bob