Richard.Cotton at hsl.gov.uk
2008-Dec-23 09:45 UTC
[R] Borders for rectangles in lattice plot key
Hopefully an easy question. When drawing a rectangles in a lattice plot
key, how do you omit the black borders?
Here is an example adapted from one on the xyplot help page:
bar.cols <- c("red", "blue")
key.list <- list(
space="top",
rectangles=list(col=bar.cols),
text=list(c("foo", "bar"))
)
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)),
col=bar.cols,
border="transparent",
key=key.list
)
Notice the black borders around the rectangles in the key.
I checked to see if there was an undocumented border component for the
rectangles compoenent of key that I could set to "transparent" or
FALSE,
but no luck. I also tried setting lwd=0 on the rectangle component but
that didn't change anything either.
Regards,
Richie.
Mathematical Sciences Unit
HSL
------------------------------------------------------------------------
ATTENTION:
This message contains privileged and confidential inform...{{dropped:20}}
On 12/23/08, Richard.Cotton at hsl.gov.uk <Richard.Cotton at hsl.gov.uk> wrote:> Hopefully an easy question. When drawing a rectangles in a lattice plot > key, how do you omit the black borders?They are currently hard-coded. I will add support for a 'border' component. -Deepayan> Here is an example adapted from one on the xyplot help page: > > bar.cols <- c("red", "blue") > key.list <- list( > space="top", > rectangles=list(col=bar.cols), > text=list(c("foo", "bar")) > ) > > 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)), > col=bar.cols, > border="transparent", > key=key.list > ) > > Notice the black borders around the rectangles in the key. > > I checked to see if there was an undocumented border component for the > rectangles compoenent of key that I could set to "transparent" or FALSE, > but no luck. I also tried setting lwd=0 on the rectangle component but > that didn't change anything either. > > Regards, > Richie. > > Mathematical Sciences Unit > HSL > > > ------------------------------------------------------------------------ > ATTENTION: > > This message contains privileged and confidential inform...{{dropped:20}} > > ______________________________________________ > R-help at 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. >