[R] line width (all elements) in Trellis

Deepayan Sarkar deepayan.sarkar at gmail.com
Mon Nov 6 21:17:39 CET 2006


On 11/6/06, Daniel E. Bunker <deb37 at columbia.edu> wrote:
> Dear All,
>
> I am hoping to implement a barchart using trellis graphics where all
> elements have a line width of 2.
>
> Using trellis.par.set(), I am able to make most elements lwd=2, but not
> all.  In particular, the top of the box (above the upper most strip) and
> the left y-axis remain one point.

Actually, those are lwd=2 too, but half of the lines are getting
clipped (this should happen on the right/bottom too, and does in PDF
output, for example. Not sure why it's not as clear on screen
devices). Anyway, you can add

trellis.par.set("clip", list(panel = "off", strip = "off"))

and see if that helps you.

I can't decide yet if the current behaviour is desirable, so it might
change in future.

-Deepayan

> Code with a barchart() example is below.  Any advice would be greatly
> appreciated.
>
> Thanks for your time,
>
> Dan
>
> note: I am using R 2.4.0 on a windows platform.
>
>
> windows(width=6, height=4, record=TRUE)
>
> tpar1=trellis.par.get("add.line")
> tpar1$lwd=2
> trellis.par.set("add.line", tpar1)
>
> tpar2=trellis.par.get("plot.polygon")
> tpar2$lwd=2
> trellis.par.set("plot.polygon", tpar2)
>
> tpar3=trellis.par.get("plot.line")
> tpar3$lwd=2
> trellis.par.set("plot.line", tpar3)
>
> tpar4=trellis.par.get("superpose.polygon")
> tpar4$lwd=c(rep(2,7))
> trellis.par.set("superpose.polygon", tpar4)
>
> tpar5=trellis.par.get("superpose.line")
> tpar5$lwd=c(rep(2,7))
> trellis.par.set("superpose.line", tpar5)
>
> tpar6=trellis.par.get("axis.line")
> tpar6$lwd=c(rep(2,7))
> trellis.par.set("axis.line", tpar6)
>
> tpar7=trellis.par.get("box.3d")
> tpar7$lwd=2
> trellis.par.set("box.3d", tpar7)
>
> tpar8=trellis.par.get("box.rectangle")
> tpar8$lwd=2
> trellis.par.set("box.rectangle", tpar8)
>
> tpar9=trellis.par.get("box.umbrella")
> tpar9$lwd=2
> trellis.par.set("box.umbrella", tpar9)
>
> tpar10=trellis.par.get("dot.line")
> tpar10$lwd=2
> trellis.par.set("dot.line", tpar10)
>
> tpar11=trellis.par.get("strip.border")
> tpar11$lwd=c(rep(2,7))
> trellis.par.set("strip.border", tpar11)
>
> tpar12=trellis.par.get("reference.line")
> tpar12$lwd=c(rep(2,7))
> trellis.par.set("reference.line", tpar12)
>
>
> barchart(yield ~ variety | site, data = barley, groups = year,
>      layout = c(1, 6), ylab = "Barley Yield (bushels/acre)", scales =
>         list(x = list(abbreviate = TRUE,
>          minlength = 5)))



More information about the R-help mailing list