[R] lattice xyplot with bty="l"

Deepayan Sarkar deepayan.sarkar at gmail.com
Wed Jul 7 22:20:22 CEST 2010


2010/7/5 László Sándor <sandorl at gmail.com>:
> Hi all,
>
> Back in 2007, Deepayan and Patrick had an exchange about how to modify
> axes for lattice plots (pasted below). I need something similar, but I
> also need to produce ticks on the axes. Deepayan quickly coded up
> substitute gridlines because they needed to make the default box
> transparent. The code works, but it lacks the ticks, and I could not
> google up how to add them.
>
> (I would be taken aback if you could even help me but this option into
> a theme for the latticeExtra package -- the grid options there do not
> seem to allow left and bottom axes at the same time. Not even
> asTheEconomist command, though I thought I have seen plot with
> "bty="l" " in The Economist...)
>
> I understand that panels in lattice were not intended for such use
> originally, but for many advanced features of the lattice package, my
> team wants to use this. The specific goal would be to produce graphs
> in R like those here:
> http://obs.rc.fas.harvard.edu/chetty/denmark_adjcost_slides.pdf  .
>
> Any help would be greatly appreciated.

The first step would be

xyplot(1:10 ~ 1:10, par.settings=list(axis.line = list(col = "transparent")),
        scales = list(col = "black", tck = c(1, 0)))

You can then add the sides in the panel function (or axis function).

-Deepayan



More information about the R-help mailing list