Hello,
My colleagues and I use lattice for a variety of different purposes, and we
came across a couple issues involving legend.R and update.trellis.R:
1. When using xyplot, the shapes in the plots are able to have borders and fill
colours, but not so in the legend. I created a short script to isolate the
problem (see legend-icons.R and Nofill.png).
After some tracing through the source code, it turned out that the "fill"
argument in "key" was being dropped by the line
pars <- pars[!sapply(pars, is.null)] # remove NULL components (lines 302
and 322)
As in key$fill was NULL when passed. The issue seems to be from the function
process.key(). The output list does not return "fill" as one of its arguments,
and was dropped whenever "key" was processed.
2. Giving multiple grobs to the 'inside' part of 'legend' only uses the first
grob if you use update.trellis to provide them. This is caused by the way
modifyList handles list elements with the same name (which is called by
update.trellis), and can be worked around (see update.trellis.R).
The issue without modification to your code can be seen in Notext.png
(created by legend-text.R). Multiple grobs could still be given to 'inside' via
the other methods (e.g. xyplot and the like).
I've made a few modifications to the source code and uploaded them here as well
(legend.R and update.trellis.R).
For Issue 1, I added the line "fill = fill," to the output list of
process.key(), and this seems to have fixed the issue (see legend.R line 216
and Fill.png for results).
For Issue 2 there is a workaround in update.trellis.R lines 267-275 (see
Text.png for the results).
James Hawley
Student
Ontario Institute for Cancer Research
MaRS Centre, South Tower
101 College Street, Suite 800
Toronto, Ontario, Canada M5G 0A3
Toll-free: 1-866-678-6427
Twitter: @OICR_news
www.oicr.on.ca
This message and any attachments may contain confidential and/or privileged
information for the sole use of the intended recipient. Any review or
distribution by anyone other than the person for whom it was originally
intended is strictly prohibited. If you have received this message in error,
please contact the sender and delete all copies. Opinions, conclusions or other
information contained in this message may not be that of the organization.
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel