On Wednesday 01 June 2005 05:43, Pikounis, Bill [CNTUS] wrote: > Hello, > I wish to customize the tick marks and labels of axes in panels produced by > high-level lattice functions, namely xyplot. I know I can use the scales > argument to specify values for rot, cex, etc. in the top-level call. > > However, I am interested in determining values for cex and rot based on the > current panel / viewport and device. More specifically, I would like to > make adjustments when tick labels overlap on the x-axis, such as labels of > a factor. If I use base graphics, par("cin") or par("cxy") or strwidth(), > etc. can be used to develop an algorithm to adjust cex or/and rot if > needed. > > I am trying to determine the parameters/settings in grid analogous to > par("cin"), etc. mentioned above, knowing that par() has no effect in > lattice / grid. I have dug around the sources for grid and lattice but > cannot seem to come up with such parameters -- most notably something like > strwidth(). I see that panel.axis() has a check.overlap argument for > labels, but I could not trace down the actual code to see how that works. > What have I overlooked, or where should I be looking?
Paul may be able to give a more insightful answer, but grid allows a string to determine it's width in terms of itself, e.g.: unit(1, "strwidth", data = "foo") If you want to convert that into, say, inches, you could use > convertX(unit(1, "strwidth", data = "foo"), "inches", TRUE) [1] 0.2344092 I think this would depend on the gpars() in effect, in particular fontsize. > Indirectly related, setting outside=TRUE in a panel.axis() call does not > produce visible labels, perhaps due to "issues of clipping" as mentioned in > its help page. How might one disable clipping for the current panel / > viewport? At the grid level, there's a 'clip' argument to 'viewport()'. In lattice, these are chosen from > str(trellis.par.get("clip")) List of 2 $ panel: chr "on" $ strip: chr "on" (In case you are using 'trellis.focus', that can set clipping off.) Deepayan ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html