Re: [matplotlib-devel] Question on sphinxext.plot_directive...

2009-09-14 Thread Michael Droettboom
Fernando Perez wrote:
> I renamed it because there's a bit of a conflict with the current
> 'plot' directive, which allows a filename *or* a content block, but in
> that case the content block is meant to be the source code, as
> illustrated in sampledoc:
>
> http://matplotlib.sourceforge.net/sampledoc/extensions.html#inserting-matplotlib-plots
>
> Since I'm not sure if we can find a clean solution to:
>
> - path to script: goes into arg list
> - inlined (multiline) code: goes into content block
> - inlined (possibly multiline) caption: goes into content block
>   
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.

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.

Mike

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Question on sphinxext.plot_directive...

2009-09-14 Thread Michael Droettboom
Fernando Perez wrote:
> I renamed it because there's a bit of a conflict with the current
> 'plot' directive, which allows a filename *or* a content block, but in
> that case the content block is meant to be the source code, as
> illustrated in sampledoc:
>
> http://matplotlib.sourceforge.net/sampledoc/extensions.html#inserting-matplotlib-plots
>
> Since I'm not sure if we can find a clean solution to:
>
> - path to script: goes into arg list
> - inlined (multiline) code: goes into content block
> - inlined (possibly multiline) caption: goes into content block
>   
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.

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.

Mike

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Question on sphinxext.plot_directive...

2009-09-14 Thread Fernando Perez
Hi Michael,

On Mon, Sep 14, 2009 at 6:57 AM, Michael Droettboom  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® 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-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel