[IPython-User] what triggers a figure redraw / inline

Fernando Perez fperez.net@gmail....
Thu Feb 23 18:18:57 CST 2012

On Thu, Feb 23, 2012 at 1:31 PM, John Hunter <jdh2358@gmail.com> wrote:
> My bad -- I was translating this example
> http://matplotlib.sourceforge.net/examples/axes_grid/scatter_hist.html
> which may have pre-dated your much superior "plt.subplots".  Fixed now.

Ahh, I can breathe better already :)  Speaking of the gallery (this is
getting OT for ipython), I think it's in serious need of a cleanup.  I
appreciate today's PR on organizing it by sections, but the real issue
is that over the years, the gallery has accrued a lot of scripts
without any comments or explanations of purpose, deprecated APIs, etc.
 I wonder if you could spur a 'gallery cleanup' project, encouraging
users to submit pull requests that remove duplicate/similar examples,
document better the ones left, etc.  While there's a lot of good stuff
there and I continue to point people to it, there really is also a
massive amount of weed growth that is starting to be annoying in

But the cleanup job is easy, can be done by non-experts (and is hence
a great one for new developers to start contributing) and would be
very beneficial to the project at large.

>  Incidentally, I was thinking about presenting this example in a talk, and
> was contemplating cutting-and-pasting the code into a standard ipython
> terminal piece by piece to illustrate the effect of each axes divider call
> (like an hbox or vbox for mpl figures, thanks JJ).  The for loops near the
> end:
>   for tl in axHistx.get_xticklabels():
>       tl.set_visible(False)
>   axHistx.set_yticks([0, 50, 100])
> are not friendly to paste into ipython terminal shells because they do not
> have the blank line after the indent.  Then I realized, aha, this is
> precisely what the notebook excels at: building up a code example with
> multi-line input in chunks.

Yes, that's really one thing it's great at.  And by purposefully
controlling explicit references to your axes, you can do the buildup
incrementally.  And the '>' "play" button in the new UI is great for
demos, as you can by and large run a demo just by clicking repeatedly
on that button.  I've been quite happy with that pattern.



More information about the IPython-User mailing list