Hi
Tim Churches wrote: > Paul Murrell wrote: > >> Hi >> >> Deepayan Sarkar wrote: >> > On 9/7/05, Tim Churches <[EMAIL PROTECTED]> wrote: >> > >> >> Version 2.1.1 Platforms: all >> >> >> >> What is the trellis parameter (or is there a trellis parameter) to >> >> set the leading (the gap between lines) when long axis values >> >> labels or panel header labels wrap over more than one line? By >> >> default, there is a huge gap between lines, and much looking and >> >> experimentation has not revealed to me a suitable parameter to >> >> adjust this. >> >> >> > >> > There is none. Whatever grid.text does happens. >> >> grid does have a "lineheight" graphical parameter. For example, >> >> library(grid) >> grid.text("line one\nlinetwo", >> x=rep(1:3/4, each=3), >> y=rep(1:3/4, 3), >> gp=gpar(lineheight=1:9/2)) >> >> Could you add this in relevant places in trellis.par Deepayan? >> > Is there a work around we could use in the meantime, or should we > attempt to hack trellis.par as per Paul's suggestion (gulp!)? I suppose > that is like asking "Should we attempt to climb Teichelmann?" - it > depends... We have increased the depth of the panel headers, but this > wastes plotting area and the tops of the tees and effs on the upper line > and the bottoms of the gees and whys on the bottom line are still cut > off, so large is the gap between the two lines. And increasing the > panel header depth it doesn't help with y-axis labels - typically the > second line of one label will abut the first line of the next label, > giving a results which is rather like: > > Value > - > One > Value > - > Two > Value > - > Three > Value > - > Four > > where the actual value labels are "Value One", "Value Two" etc and the > "-" are the tick marks. Less than ideal. > > Suggestions for interim fixes (other than using abbreviated labels... > we've thought of that) most welcome. I don't think lattice explicitly sets lineheight so you could try something like the following (push a [full-page] grid viewport that sets lineheight then draw lattice plot within that) ... library(grid) library(lattice) states <- data.frame(state.x77, state.name = dimnames(state.x77)[[1]], state.region = factor(state.region)) levels(states$state.region) <- c("Northeast", "South", "North\n Central", "West") xyp <- xyplot(Murder ~ Population | state.region, data = states, groups = as.character(state.name), panel = function(x, y, subscripts, groups) ltext(x = x, y = y, label = groups[subscripts], srt = -50, col = "blue", cex=.9, fontfamily = "HersheySans"), par.strip.text = list(cex = 1.3, font = 4, col = "brown", lines = 2), xlab = "Estimated Population\nJuly 1, 1975", ylab = "Murder Rate \n(per 100,000 population)\n 1976", main = "Murder Rates in US states") # default line height for comparison print(xyp) # control line height grid.newpage() pushViewport(viewport(gp=gpar(lineheight=0.8))) print(xyp, newpage=FALSE) popViewport() ... this does not work perfectly for me, but I'm not sure (yet) whether that is a problem in grid, a problem in lattice, or a problem with Hershey fonts (that are used in this example) so your mileage may vary. Paul -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ ______________________________________________ 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