IPython (new) + matplotlib report: happy news

Hi folks,

[ sorry for the cross-post, but devs on both lists will care about this]

I just went through the exercise of pasting 100 randomly chosen
examples from the gallery into the new ipython console with inline
graphics. Report:

- 98 worked perfectly: the figures I got were identical to those on the website.

- 1 had minor visual differences:
http://matplotlib.sourceforge.net/examples/pylab_examples/quadmesh_demo.html:
in the SVG render, the masked region
appears black instead of transparent.

- One produced an error:
http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline4.html

...
   ...: plt.draw()
   ...: plt.show()
   ...:
Received invalid plot data.

But when I save the file and try to load it into firefox, it seems to
indeed be bad SVG:

XML Parsing Error: mismatched tag. Expected: </g>.
Location: file:///home/fperez/ipython/ipython/bad.svg
Line Number 287, Column 3:</svg>
--^

In summary: we can run pretty much any MPL example by straight
copy/paste, and the only two glitches I see are in the SVG data
itself. Once the other two buglets I reported earlier get fixed up,
this will be a very nice way to interact with MPL.

One small request: is it possible/easy to add to the MPL examples a
little 'copy to clipboard' button or link? Now that one can
copy/paste wholesale examples into an interactive session to explore
them, it feels annoying to have to highlight the whole text box and
then do Ctrl-C or menu->copy. It would be really nice to have a
one-click 'copy to clipboard'... But I have no idea if that's easy or
hard in HTML...

Anyway, I think we're starting to be in pretty good shape!

Cheers,

f

Fernando,

Hi folks,

[ sorry for the cross-post, but devs on both lists will care about this]

I just went through the exercise of pasting 100 randomly chosen
examples from the gallery into the new ipython console with inline
graphics. Report:

- 98 worked perfectly: the figures I got were identical to those on the website.

That is a pretty significant test of the new console....100 is a lot
of copying and pasting.

- 1 had minor visual differences:
http://matplotlib.sourceforge.net/examples/pylab_examples/quadmesh_demo.html:
in the SVG render, the masked region
appears black instead of transparent.

- One produced an error:
http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline4.html

...
...: plt.draw()
...: plt.show()
...:
Received invalid plot data.

But when I save the file and try to load it into firefox, it seems to
indeed be bad SVG:

XML Parsing Error: mismatched tag. Expected: </g>.
Location: file:///home/fperez/ipython/ipython/bad.svg
Line Number 287, Column 3:</svg>
--^

In summary: we can run pretty much any MPL example by straight
copy/paste, and the only two glitches I see are in the SVG data
itself. Once the other two buglets I reported earlier get fixed up,
this will be a very nice way to interact with MPL.

One small request: is it possible/easy to add to the MPL examples a
little 'copy to clipboard' button or link? Now that one can
copy/paste wholesale examples into an interactive session to explore
them, it feels annoying to have to highlight the whole text box and
then do Ctrl-C or menu->copy. It would be really nice to have a
one-click 'copy to clipboard'... But I have no idea if that's easy or
hard in HTML...

+1 to this!

Cheers,

Brian

···

On Mon, Sep 13, 2010 at 1:58 PM, Fernando Perez <fperez.net@...149...> wrote:

Anyway, I think we're starting to be in pretty good shape!

Cheers,

f
_______________________________________________
IPython-dev mailing list
IPython-dev@...336...
http://mail.scipy.org/mailman/listinfo/ipython-dev

--
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger@...882...
ellisonbg@...149...

Hi Fernando,

···

On Mon, Sep 13, 2010 at 3:58 PM, Fernando Perez <fperez.net@gmail.com> wrote:

Hi folks,

One small request: is it possible/easy to add to the MPL examples a

little ‘copy to clipboard’ button or link? Now that one can

copy/paste wholesale examples into an interactive session to explore

them, it feels annoying to have to highlight the whole text box and

then do Ctrl-C or menu->copy. It would be really nice to have a

one-click ‘copy to clipboard’… But I have no idea if that’s easy or

hard in HTML…

Either in Firefox or Chrome you could use extensions [Auto Copy] to copy text selections into clipboard.


Gökhan

Thanks, that's good to know. But I'm mostly thinking of teaching
situations, so it would be nice to have this in the source: it's not
for my use but for the benefit of students who may be in a lab where
they can't install extensions. But I don't know if that can even be
done in html in the first place.

Cheers,

f

···

On Mon, Sep 13, 2010 at 2:22 PM, Gökhan Sever <gokhansever@...149...> wrote:

Either in Firefox or Chrome you could use extensions [Auto Copy] to copy
text selections into clipboard.

In github, there is something like this for copying the address of someone’s git repo, but it might be done using Flash, I am not sure.

Ben Root

···

On Mon, Sep 13, 2010 at 6:44 PM, Fernando Perez <fperez.net@gmail.com> wrote:

On Mon, Sep 13, 2010 at 2:22 PM, Gökhan Sever <gokhansever@…149…> wrote:

Either in Firefox or Chrome you could use extensions [Auto Copy] to copy

text selections into clipboard.

Thanks, that’s good to know. But I’m mostly thinking of teaching

situations, so it would be nice to have this in the source: it’s not

for my use but for the benefit of students who may be in a lab where

they can’t install extensions. But I don’t know if that can even be

done in html in the first place.

Cheers,

f

You can definitely hijack copies with JavaScript:

Nice work IPython people! I haven't been following too closely but this looks exciting.

David

···

On 2010-09-13, at 7:44 PM, Fernando Perez wrote:

Thanks, that's good to know. But I'm mostly thinking of teaching
situations, so it would be nice to have this in the source: it's not
for my use but for the benefit of students who may be in a lab where
they can't install extensions. But I don't know if that can even be
done in html in the first place.

I think there might be a couple different approaches that might be useful for educational purposes of IPython + matplotlib usage. For instance:

1-) When one downloads a script from the matplotlib gallery via an external script (name it load_into_ipython or open_with_ipython) the contents of that gallery script (or any python script) can be executed locally inside an ipython session.

2-) Matplotlib gallery might turn to an interactive environment where you can execute the script from right within your browser and change parameters in the same browser window. As far as I know mpl figures can now be drawn on html canvas. This might for sure boost the number of matplotlib audience.

···

On Mon, Sep 13, 2010 at 6:44 PM, Fernando Perez <fperez.net@gmail.com> wrote:

Thanks, that’s good to know. But I’m mostly thinking of teaching

situations, so it would be nice to have this in the source: it’s not

for my use but for the benefit of students who may be in a lab where

they can’t install extensions. But I don’t know if that can even be

done in html in the first place.


Gökhan

On a quick googling, there are some IE only Javascript examples to do
this. Apparently you can enable them in firefox but it requires a
significant amount of about:config hackery
(http://www.febooti.com/support/website-help/website-javascript-copy-clipboard.html).

How about this as an alternative: on my box, I can drag the "source
code" link from the browser into my terminal, which by default pastes
the URL of the referenced *.py into the terminal. If "run" supported
a -w (web) option, or automatically detected that the URL starts with
http, it could do a web run of the file. Of course, you may want the
source code pasted in for illustrative purposes... To support this,
you could add a -u (url) option to "paste" which assumes the input is
a url, fetches it, and pastes the contents into ipython. So you could
type "paste -u" and then drag the link into the terminal, and it would
fetch it and paste the code into an input block.

JDH

···

On Mon, Sep 13, 2010 at 4:10 PM, Brian Granger <ellisonbg@...149...> wrote:

One small request: is it possible/easy to add to the MPL examples a
little 'copy to clipboard' button or link? Now that one can
copy/paste wholesale examples into an interactive session to explore
them, it feels annoying to have to highlight the whole text box and
then do Ctrl-C or menu->copy. It would be really nice to have a
one-click 'copy to clipboard'... But I have no idea if that's easy or
hard in HTML...

+1 to this!

Hi folks,

[ sorry for the cross-post, but devs on both lists will care about this]

I just went through the exercise of pasting 100 randomly chosen
examples from the gallery into the new ipython console with inline
graphics. Report:

- 98 worked perfectly: the figures I got were identical to those on the website.

- 1 had minor visual differences:
http://matplotlib.sourceforge.net/examples/pylab_examples/quadmesh_demo.html:
in the SVG render, the masked region
appears black instead of transparent.
   

This is now fixed in r8699.

- One produced an error:
http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline4.html

...
    ...: plt.draw()
    ...: plt.show()
    ...:
Received invalid plot data.
   

This is now fixed in r8700.

But when I save the file and try to load it into firefox, it seems to
indeed be bad SVG:

XML Parsing Error: mismatched tag. Expected:</g>.
Location: file:///home/fperez/ipython/ipython/bad.svg
Line Number 287, Column 3:</svg>
--^

In summary: we can run pretty much any MPL example by straight
copy/paste, and the only two glitches I see are in the SVG data
itself. Once the other two buglets I reported earlier get fixed up,
this will be a very nice way to interact with MPL.

One small request: is it possible/easy to add to the MPL examples a
little 'copy to clipboard' button or link? Now that one can
copy/paste wholesale examples into an interactive session to explore
them, it feels annoying to have to highlight the whole text box and
then do Ctrl-C or menu->copy. It would be really nice to have a
one-click 'copy to clipboard'... But I have no idea if that's easy or
hard in HTML...
   

Good idea. I'll have a look at how hard this would be to add as a Sphinx extension.

Cheers,
Mike

···

On 09/13/2010 04:58 PM, Fernando Perez wrote:

Anyway, I think we're starting to be in pretty good shape!

Cheers,

f

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options
   
--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA

This is now fixed in r8699.

- One produced an error:
http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline4.html

...
...: plt.draw()
...: plt.show()
...:
Received invalid plot data.

This is now fixed in r8700.

Great, many thanks for these fixes! It means that we're probably
capable now of running just about every pylab example out of the
box... We'll keep testing and will report if we see anything weird.

One small request: is it possible/easy to add to the MPL examples a
little 'copy to clipboard' button or link? Now that one can
copy/paste wholesale examples into an interactive session to explore
them, it feels annoying to have to highlight the whole text box and
then do Ctrl-C or menu->copy. It would be really nice to have a
one-click 'copy to clipboard'... But I have no idea if that's easy or
hard in HTML...

Good idea. I'll have a look at how hard this would be to add as a
Sphinx extension.

Great, if it can be done it would be wonderful (Robert indicated it
may require flash, but others provided JS pointers; I'll leave it to
you to navigate those lovely waters :slight_smile:

Cheers,

f

···

On Tue, Sep 14, 2010 at 8:59 AM, Michael Droettboom <mdroe@...31...> wrote:

Thanks, David. Hopefully by next week we'll complete our
stabilization so that we're willing to foist this on the ipython-dev
and mpl-dev denizens. Anyone is welcome to try it out now, but we're
moving things around enough that at any given point it may or may not
work. We'll move it into trunk once the churn stops.

Regards,

f

···

On Mon, Sep 13, 2010 at 7:08 PM, David Warde-Farley <wardefar@...301...> wrote:

Nice work IPython people! I haven't been following too closely but this looks exciting.

Hey,

How about this as an alternative: on my box, I can drag the "source
code" link from the browser into my terminal, which by default pastes
the URL of the referenced *.py into the terminal. If "run" supported
a -w (web) option, or automatically detected that the URL starts with
http, it could do a web run of the file. Of course, you may want the
source code pasted in for illustrative purposes... To support this,
you could add a -u (url) option to "paste" which assumes the input is
a url, fetches it, and pastes the contents into ipython. So you could
type "paste -u" and then drag the link into the terminal, and it would
fetch it and paste the code into an input block.

I'll play with those ideas, good thoughts. %paste may not be the best
location because paste is now a terminal-only magic, since gui clients
have 'real' paste. What's a little trickier now is that we really
need to think all the time in terms of completely separate kernel and
client codes, that only communicate via messages. So a magic can't
muck with code in the client, because the magic executes inside the
kernel and the client is in a separate process (and possibly in a
separate computer). While this is a bit more constraining, it forces
us to have a clean separation between different kinds of
functionality.

We've toyed with the idea of enabling a special syntax for *purely
client side* commands, something like

:cmd

that would never be sent to the kernel, and would be something for the
client to process internally. But we'll have to mull this a little
longer...

One very important point in all of this is that the client *may not be
written in Python*. All we have is a messaging protocol, the client
could be a web browser or anything else.

But in any case, I'll play with ways to expose this that are as easy
as possible for the users thanks for the feedback.

Cheers,

f

···

On Tue, Sep 14, 2010 at 8:21 AM, John Hunter <jdh2358@...149...> wrote:

1-) When one downloads a script from the matplotlib gallery via an external
script (name it load_into_ipython or open_with_ipython) the contents of that
gallery script (or any python script) can be executed locally inside an
ipython session.

Not to be difficult, but I should point out that allowing users to run
code with one click, particularly if that code is from a wiki or other
user-submitted gallery, is just asking for trouble. How long before
someone submits "import os, shutil;
shutil.deltree(os.environ['HOME'])"? Or sneaks it into some otherwise
inoffensive script?

2-) Matplotlib gallery might turn to an interactive environment where you
can execute the script from right within your browser and change parameters
in the same browser window. As far as I know mpl figures can now be drawn on
html canvas. This might for sure boost the number of matplotlib audience.

Is there a sandboxed browser plugin? Or server plugin, depending on
where you run the script?

Anne

···

On 14 September 2010 11:08, Gökhan Sever <gokhansever@...149...> wrote:

1-) When one downloads a script from the matplotlib gallery via an external
script (name it load_into_ipython or open_with_ipython) the contents of that
gallery script (or any python script) can be executed locally inside an
ipython session.

Not to be difficult, but I should point out that allowing users to run
code with one click, particularly if that code is from a wiki or other
user-submitted gallery, is just asking for trouble. How long before
someone submits "import os, shutil;
shutil.deltree(os.environ['HOME'])"? Or sneaks it into some otherwise
inoffensive script?

Very valid points. I'm leaning more towards something like a
combination of (hopefully) a 'copy code' button on the MPL webpages
themselves, so users don't have to scroll/highlight a lot but would
still do paste, execute manually, and a special %mplexample magic.

This would only run examples from the mpl gallery (hardcoding the
path), would display the code to the user first, and would ask for
confirmation before execution. Since those html pages are built by
executing those same scripts, there's a layer of sanity already built
into it (the rmtree call would have already nuked the builder's home
directory in the build process if it had been there). Showing the
code to the user and confirming execution before proceeding adds a
final chance for the person to check her parachute before jumping off
the cliff.

Does that sound reasonable?

2-) Matplotlib gallery might turn to an interactive environment where you
can execute the script from right within your browser and change parameters
in the same browser window. As far as I know mpl figures can now be drawn on
html canvas. This might for sure boost the number of matplotlib audience.

Is there a sandboxed browser plugin? Or server plugin, depending on
where you run the script?

This would have to be server-side, and code needs to be written. Part
of our interest with this explicit separation of ipython kernel and
clients with a well-defined protocol is to make the above possible.
But we haven't written any of the code necessary to have a browser
client, and to serve code read from a sphinx-generated HTML page.
Gokhan, your patches will be welcome, the infrastructure is now ready
and waiting for you :slight_smile:

Cheers,

f

···

On Tue, Sep 14, 2010 at 11:48 AM, Anne Archibald <aarchiba@...824...> wrote:

On 14 September 2010 11:08, Gökhan Sever <gokhansever@...149...> wrote:

1-) When one downloads a script from the matplotlib gallery via an external

script (name it load_into_ipython or open_with_ipython) the contents of that

gallery script (or any python script) can be executed locally inside an

ipython session.

Not to be difficult, but I should point out that allowing users to run

code with one click, particularly if that code is from a wiki or other

user-submitted gallery, is just asking for trouble. How long before

someone submits "import os, shutil;

shutil.deltree(os.environ[‘HOME’])"? Or sneaks it into some otherwise

inoffensive script?

I was thinking naively --with Python for Science in mind not Python for Hacking. I accept this is a not good idea considering that harmful effect but in this brave new world of us there is always danger involved when one puts their hands on virtual lands --whether the code is executed intentionally or sneaked by a conic head.

2-) Matplotlib gallery might turn to an interactive environment where you

can execute the script from right within your browser and change parameters

in the same browser window. As far as I know mpl figures can now be drawn on

html canvas. This might for sure boost the number of matplotlib audience.

Is there a sandboxed browser plugin? Or server plugin, depending on

where you run the script?

This one is one of my aloud speculations. Only at ideas level. I will write more, answering Fernando’s reply.

···

On Tue, Sep 14, 2010 at 1:48 PM, Anne Archibald <aarchiba@…877…> wrote:

On 14 September 2010 11:08, Gökhan Sever <gokhansever@…149…> wrote:

Anne


Gökhan

Sage provides some level of interaction actually without any deployment made on local side. Try for instance the following example on sagenb.org

from scipy import stats

import numpy as np

import matplotlib.pyplot as plt

@interact

def plot_gamma(a=(1,(1,10)), loc=(0,(0,10)), scale=(1,(1,10))):

rv = stats.gamma(a, loc, scale)

x = np.linspace(-1,20,1000)

plt.plot(x,rv.pdf(x))

plt.grid(True)

plt.savefig(‘plt.png’)

plt.clf()

This one is very useful for educational and demonstrative purposes. Still requires a bit Sage syntax manipulations to make things fully interacting on browser.

Nice that you have matured IPython infra for implementing such interactive functionality. I was thinking perhaps running something on top GApss Engine but not sure they allow compiling/running C/C++ extensions on their servers. Alternatively, like in Sage servers virtual OS’es might be the way to go with it then possibly there will be user registration and management issues (not sure about all specifics).

Probably, Ondrej might like experiencing with this idea :slight_smile: Since he has similar initiatives and asking help on similar topics. I am trying to graduate myself working to solve some of my research problems and struggling with writing especially to move on PhD. This might be a very fun Summer job if I am wandering around jobless then.

···

On Tue, Sep 14, 2010 at 1:58 PM, Fernando Perez <fperez.net@gmail.com> wrote:

2-) Matplotlib gallery might turn to an interactive environment where you

can execute the script from right within your browser and change parameters

in the same browser window. As far as I know mpl figures can now be drawn on

html canvas. This might for sure boost the number of matplotlib audience.

Is there a sandboxed browser plugin? Or server plugin, depending on

where you run the script?

This would have to be server-side, and code needs to be written. Part

of our interest with this explicit separation of ipython kernel and

clients with a well-defined protocol is to make the above possible.

But we haven’t written any of the code necessary to have a browser

client, and to serve code read from a sphinx-generated HTML page.

Gokhan, your patches will be welcome, the infrastructure is now ready

and waiting for you :slight_smile:


Gökhan

Actually sage does have one *implicit* but very particular 'local
deployment': its notebook execution model is *strictly* tied to the
idea that the client is a web browser. Try this code in the sage
terminal (i.e. their customized ipython, not the notebook):

sage: @interact
....: def x(a=(1, (1, 10))):
....: print a
....:

and you'll see:

<html><!--notruncate--><div padding=6 id='div-interact-0'> <table
width=800px height=20px bgcolor='#c5c5c5'
                 cellpadding=15><tr><td bgcolor='#f9f9f9' valign=top
align=left><table><tr><td align=right><font
color="black">a&nbsp;</font></td><td><table><tr><td>
        <div id='slider-a-0' style='margin:0px; margin-left: 1.0em;
margin-right: 1.0em; width: 15.0em;'></div>

... lots more...

</table><div id='cell-interact-0'><?__SAGE__START>
        <table border=0 bgcolor='#white' width=100% height=100%>
        <tr><td bgcolor=white align=left
valign=top><pre><?__SAGE__TEXT></pre></td></tr>
        <tr><td align=left valign=top><?__SAGE__HTML></td></tr>
        </table><?__SAGE__END></div></td>
                 </tr></table></div>
                 </html>
sage:

So you can see, @interact in sage does basically:

- analyze the inputs of the function
- do some basic 'type inference' and emit javascript/html controls for
each parameter.
- emit an html section that wires the above controls to repeated calls
of the decorated function as the controls are operated.

This is very cool, and it enables great functionality, but it's
hard-coded to an html/javascript client.

What we're doing is a little different, as we've built a *protocol*
that clients can use to talk to the kernel, regardless of how they are
implemented.

As the functionality matures, we'll see who contributes a
browser-based client (that will require wrapping the kernel in an http
server, obviously). And then the question of things like @interact
will be an interesting one to think about. @interact by nature is
creating a user interface (Mathematica's Manipulate creates Notebook
controls, sage's @interact creates HTML ones). I'm not sure yet how
we'll approach that: having per-client implementations? A traits-style
approach where each client renders it differently? No idea yet.

Cheers,

f

···

On Tue, Sep 14, 2010 at 12:38 PM, Gökhan Sever <gokhansever@...149...> wrote:

Sage provides some level of interaction actually without any deployment made
on local side. Try for instance the following example on sagenb.org
from scipy import stats
import numpy as np
import matplotlib.pyplot as plt
@interact
def plot_gamma(a=(1,(1,10)), loc=(0,(0,10)), scale=(1,(1,10))):
rv = stats.gamma(a, loc, scale)
x = np.linspace(-1,20,1000)
plt.plot(x,rv.pdf(x))
plt.grid(True)
plt.savefig('plt.png')
plt.clf()
This one is very useful for educational and demonstrative purposes. Still
requires a bit Sage syntax manipulations to make things fully interacting on
browser.
Nice that you have matured IPython infra for implementing
such interactive functionality. I was thinking perhaps running something on
top GApss Engine but not sure they allow compiling/running C/C++ extensions
on their servers. Alternatively, like in Sage servers virtual OS'es might be
the way to go with it then possibly there will be user registration and
management issues (not sure about all specifics).

1-) When one downloads a script from the matplotlib gallery via an external

script (name it load_into_ipython or open_with_ipython) the contents of that

gallery script (or any python script) can be executed locally inside an

ipython session.

Not to be difficult, but I should point out that allowing users to run

code with one click, particularly if that code is from a wiki or other

user-submitted gallery, is just asking for trouble. How long before

someone submits "import os, shutil;

shutil.deltree(os.environ[‘HOME’])"? Or sneaks it into some otherwise

inoffensive script?

Very valid points. I’m leaning more towards something like a

combination of (hopefully) a ‘copy code’ button on the MPL webpages

themselves, so users don’t have to scroll/highlight a lot but would

still do paste, execute manually, and a special %mplexample magic.

This would only run examples from the mpl gallery (hardcoding the

path), would display the code to the user first, and would ask for

confirmation before execution. Since those html pages are built by

executing those same scripts, there’s a layer of sanity already built

into it (the rmtree call would have already nuked the builder’s home

directory in the build process if it had been there). Showing the

code to the user and confirming execution before proceeding adds a

final chance for the person to check her parachute before jumping off

the cliff.

Does that sound reasonable?

2-) Matplotlib gallery might turn to an interactive environment where you

can execute the script from right within your browser and change parameters

in the same browser window. As far as I know mpl figures can now be drawn on

html canvas. This might for sure boost the number of matplotlib audience.

Is there a sandboxed browser plugin? Or server plugin, depending on

where you run the script?

This would have to be server-side, and code needs to be written. Part

of our interest with this explicit separation of ipython kernel and

clients with a well-defined protocol is to make the above possible.

But we haven’t written any of the code necessary to have a browser

client, and to serve code read from a sphinx-generated HTML page.

Gokhan, your patches will be welcome, the infrastructure is now ready

and waiting for you :slight_smile:

Cheers,

f

Just a crazy idea to consider that would completely bypass this whole vulnerability issue…

Why not have an examples module that contains function calls to each example? On the website, we can show the source code, but also say that one could just do:

import matplotlib.examples as ex
ex.bars3d_demo()

My 2 cents…

Ben Root

···

On Tue, Sep 14, 2010 at 1:58 PM, Fernando Perez <fperez.net@gmail.com> wrote:

On Tue, Sep 14, 2010 at 11:48 AM, Anne Archibald > > <aarchiba@…824…> wrote:

On 14 September 2010 11:08, Gökhan Sever <gokhansever@…149…> wrote:

The idea is to have the *actual code* pasted in your terminal, because
now we can easily edit complex multi-line examples directly in
ipython. So it's not just a matter of seeing the figure results, but
mostly of having the actual source in your input buffer to play with.

Cheers,

f

···

On Tue, Sep 14, 2010 at 12:57 PM, Benjamin Root <ben.root@...553...> wrote:

Why not have an examples module that contains function calls to each
example? On the website, we can show the source code, but also say that one
could just do:

import matplotlib.examples as ex
ex.bars3d_demo()

True… but, consider this. ipython can already display the code for a particular module/function using the ‘??’ idiom. Why not have some way to take that text and bring it into the input buffer?

I can imagine this being useful beyond matplotlib where anybody could have their example codes easily accessed and edited.

Ben Root

···

On Wed, Sep 15, 2010 at 12:39 AM, Fernando Perez <fperez.net@gmail.com> wrote:

On Tue, Sep 14, 2010 at 12:57 PM, Benjamin Root <ben.root@…553…> wrote:

Why not have an examples module that contains function calls to each

example? On the website, we can show the source code, but also say that one

could just do:

import matplotlib.examples as ex

ex.bars3d_demo()

The idea is to have the actual code pasted in your terminal, because

now we can easily edit complex multi-line examples directly in

ipython. So it’s not just a matter of seeing the figure results, but

mostly of having the actual source in your input buffer to play with.

Cheers,

f