SCM

[#2587] Bordered legend icons and Text in plots

View Trackers | Bugs | Download .csv | Monitor

Date:
2013-02-27 20:58
Priority:
3
State:
Closed
Submitted by:
James Hawley (jrhawley)
Assigned to:
Deepayan Sarkar (deepayan)
Hardware:
Other
Product:
None
Operating System:
Linux
Component:
None
Version:
None
Severity:
minor
Resolution:
Fixed
 
URL:
Summary:
Bordered legend icons and Text in plots

Detailed description
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).

Followup

Message
Date: 2013-07-19 08:11
Sender: Deepayan Sarkar

Both issues now fixed in SVN

Attached Files:

Attachments:
20-13.zip

Changes:

Field Old Value Date By
ResolutionNone2013-07-19 08:11deepayan
assigned_tonone2013-07-19 08:11deepayan
close_dateNone2013-07-19 08:11deepayan
status_idOpen2013-07-19 08:11deepayan
File Added428: 20-13.zip2013-02-27 20:58jrhawley
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge