On 2014/09/28, 8:22 AM, Thomas Caswell wrote:
> On Sun, Sep 28, 2014 at 1:52 PM, Eric Firing <efir...@hawaii.edu> wrote:
>>
>> I don't understand your objection.  In which cases do the returns depend on
>> the arguments?  "title" returns the title text object, regardless of whether
>> there was an argument setting it to a new value.  Same for "xlim".  I
>> haven't checked the whole list, but I expect this is the general pattern.
>
>
> Sorry, I rarely use that part of the API, I apparently remember it
> wrong.  I thought they returned `None` in the case where you were
> using them as setters.
>
>> But it does *not* take care of one of the two *big* problems I am talking 
>> about:
>> the lack of automatic interactive plot updating when one wants to explicitly
>> specify axes and figures in the plot call, regardless of whether this is done
>> via plotting functions or methods.
>
> I would suggest using a function identical to the pyplot wrapper, but
> just preserve the ax argument:
>
> def interactive_wrapper(func):
>      @functools.wraps(func)
>      def inner(ax, *args, **kwargs):
>          ret_list = func(ax, *args, **kwargs)
>          ax.figure.canvas.draw()
>          return ret_list
>
>      return inner

Yes, this could be done.  But it would require:

1) the switch from methods to plot functions, which is a huge change;

2) having not 1, not 2, but 3 sets of plot functions: the first with the 
ax argument and no interactivity; the second with the ax argument and 
interactivity; and the third being the pyplot version.

>
> I think it is very important to maintain a way to use mpl without
> having to involve pyplot and it's global state in anyway which is
> useful for embedding.

This needs a closer look.  I don't see that my suggestions involve 
pyplot's global state any more than at present, or that they would in 
any way affect embedding.

>
>> There is one major difference in using methods instead of plotter functions, 
>> though:
>> it allows subclassing.  Whether this is ever used in practice, I don't know
>
> I think this only matters if you want to over-ride the behavior of the
> plotting methods which I am going back and forth on if preventing this
> is a good thing or not and if monkey-patching/clever importing is the
> way around it.
>

I tend to think that monkey-patching is something to avoid, and that the 
goal should be simplicity and straightforwardness rather than cleverness.

Eric

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to