Hi

On 17/01/13 13:19, p_conno...@slingshot.co.nz wrote:
Paul Murell's article "What's in a Name" in The R Journal Vol 4/2
gives an interesting example of editing a stacked barplot of the barley
data.  Using the method described in that article, it's easy to do
something along the lines of

grid.edit("plot_01.border.strip.1",
           grep=TRUE, global=TRUE,
           gp=gpar(col = "red"))

That changes more than I'd like to change. I'd like to change only the
bottom line of the rectangle.  How would I overwrite the unwanted red
lines along the lines of what box() would do with base graphics?

You cannot modify just part of a basic shape (e.g., just the bottom line of a rectangle). One way to do what I think you want is to specify a custom strip function that draws an extra line over the top of the existing rectangle, like this ...

library(lattice)
library(grid)
barchart(yield ~ variety | site, data = barley,
         groups = year, layout = c(1,6),
         stack = TRUE,
         ylab = "Barley Yield (bushels/acre)",
         scales = list(x = list(rot = 45)),
         strip = function(...) {
             strip.default(...)
             grid.segments(0, 0, 1, 0, gp=gpar(lwd=1.5, col="red"))
         })

Is that the sort of effect you want?

Paul

TIA
Patrick

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
p...@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to