rpruim/mosaic — Issue #21: Easier interface to modifying plots from plotFun and related functions.
Author: dtkaplan
Created: 2012-02-02 16:35:01+00:00
State: open

I've been thinking a bit about how to make an easier to use interface for plotting. Here's a sketch:
1) have several different modes of plot functions, e.g. plotFun(), plotScatter(), plotField(), plotConstraint(), plotParametric(), plotLabel(), etc. Each of these would be set to do the right thing in both 2- and 3-dimensions
2) memoize the plot so that it can be reconstructed, layer by layer, where each add=TRUE adds another layer to the existing plot.
3) add function editPlot() which would allow the plot to be rescaled, or one of the one of the layers to be deleted.
4) return a lattice object, but add an attribute that is the memoized set of commands that made the plot. It would print() as usual, but editPlot() could be called on the lattice object in order to change it after the fact.
5) editPlot() might optionally use a manipulate interface, but could also be written in terms of standard menu commands

I think this would be straightforward and would to some extent replace ladd(). I'm thinking I would create a custom panel function on the fly from the memoized layers of the plot, so that panel function would change with every new plotXXX() or editPlot() command.