Bug 17386 - enable panel.first in matplot
Summary: enable panel.first in matplot
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Graphics (show other bugs)
Version: R 3.4.3
Hardware: All All
: P5 enhancement
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2018-02-13 15:15 UTC by Sebastian Meyer
Modified: 2018-04-04 18:24 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Meyer 2018-02-13 15:15:32 UTC
This is related to an almost 20-year-old observation of Martin Maechler at https://stat.ethz.ch/pipermail/r-devel/1999-September/019601.html.

In matplot(), passing the panel.first argument to plot.default(), e.g., 

    matplot((-4:5)^2, panel.first = grid())

does not have the desired effect. This is because matplot evaluates list(...) before the final plot(...) call to retrieve a potential "log" argument (as implemented in r2710), which causes an early evaluation of panel.first. The help page on plot.default accordingly states for panel.first:

   Note that this works by lazy evaluation: passing this
   argument from other ‘plot’ methods may well not work since it
   may be evaluated too early.

I think it would be nice if matplot did support the panel.first argument of plot.default. So to follow up on the discussion referenced above, my real question is:

3) Why not make the "log" argument explicit in matplot() such that the current list(...) evaluation becomes unnecessary?
Comment 1 Martin Maechler 2018-03-26 16:13:32 UTC
This seems a good idea to me.

Can you provide a patch to the sources, involving both the 
R/*.R  and man/*.Rd file?
Comment 2 Martin Maechler 2018-04-04 18:24:11 UTC
(In reply to Martin Maechler from comment #1)
> This seems a good idea to me.
> 
> Can you provide a patch to the sources, involving both the 
> R/*.R  and man/*.Rd file?

No need.  I'm doing this myself now.  It really is a very good suggestion.
Committed to R-devel in svn rev 74526