Hi Michael,

On Mon, Sep 14, 2009 at 6:57 AM, Michael Droettboom <md...@stsci.edu> wrote:
> I'm not sure it's that bad.  It's certainly possible to do all these things
> with a single directive, since providing a path or providing source code is
> mutually exclusive.  The thing one can't do is provide inline source *and* a
> caption.  I applied your patch, renaming the directive back to "plot" and
> ran it over the matplotlib docs, and it doesn't seem to break anything.

Well, if you're OK with the api-by-inputs approach (name+text =
caption, text only=code), then I have no qualms using it.  It felt a
bit hackish so I was perhaps overly cautious,  but I'd much rather:

- have this in upstream mpl than in my own projects
- have a single directive to remember

So many thanks for integrating it!

> Of course, we can also provide two directives, "plot" and "figplot" based on
> essentially the same source code.  I'm kind of neutral on the matter.

I'm pretty neutral too, though perhaps it might be worth thinking
about this a little more, to get a really good long-term solution.

Basically, what I'd like to have is a directive that can cover these
two scenarios:

1. Like today,  plot with code:

.. plot::
  plot(x,y)

2. An extended version of today's support for files, that can handle
entry points:

.. plot:: script.py func1

  Caption for figure 1

.. plot:: script.py func2

  Caption for figure 2

This would  *import* script only once, and then for each figure it
would call the given function (argumentless, to keep things simple for
now).  Basically each call would be the equivalent of

import script; script.funcN()  # N=1,2

This would make it easy to compute expensive data in script once, and
then render multiple plots out of it without re-executing the script
in full each time.

Or is this already possible with today's plot()?


I think this would cover all the use cases I have in mind, from years
of using a similar approach but with Makefiles.

Cheers,

f

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to