[R] How to auto-scale cex of y-axis labels in lattice dotplot?

Kevin Wright kw.statr at gmail.com
Thu Jul 26 05:12:25 CEST 2007


When I create a dotplot in lattice, I frequently observe overplotting
of the labels along the vertical axis.  On my screen, this illustrates
overplotting of the letters:

windows()
reps=6
dat=data.frame(let=rep(letters,each=reps), grp=rep(1:reps, 26),
  y=runif(26*reps))
dotplot(let~y|grp, dat)

Is there a way to automatically scale the labels so that they are not
over-plotted?

I currently do something like this:
Calculate or guess the number of panel rows: NumPanelRows
cexLab <- min(1, .9*par()$pin[2]/
              (nlevels(dat$let)*NumPanelRows*strheight("A",units="in")))
dotplot(..., scales=list(y=list(cex=cexLab))

Is there an easier way?

Is there a function that I can call which calculates the layout of the
panels that will be used in the dotplot?

Any tips will be appreciated.

K Wright



More information about the R-help mailing list