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

John Hunter jdh2358@gmail....
Thu Feb 23 13:11:49 CST 2012

I am working on a notebook and want to build up a figure in stages to
illustrate the effect of successive code blocks.  After the first code
cell, the figure is drawn and inlined, as expected.  After the second, no
figure is inserted, even if I try and force it to with "draw".  How are you
deciding whether to insert a figure or not, and is there a way to force the
figure redraw inline?

BTW< I am using ipython from git HEAD and the new UI is *fantastic*.  Very
nice work, and very exciting!

# -*- coding: utf-8 -*-
# <nbformat>3</nbformat>

# <codecell>

import numpy as np
import matplotlib.pyplot as plt

# the random data
x = np.random.randn(1000)
y = np.random.randn(1000)

fig = plt.figure(1, figsize=(5.5,5.5))

from mpl_toolkits.axes_grid1 import make_axes_locatable

# the scatter plot:
axScatter = plt.subplot(111)
axScatter.scatter(x, y)

# <markdowncell>

# <h1> Make the axes dividable </h1>
# Create new axes on the right and on the top of the current axes
# The first argument of the new_vertical(new_horizontal) method is
# the height (width) of the axes to be created in inches.

# <codecell>

binwidth = 0.25
xymax = np.max( [np.max(np.fabs(x)), np.max(np.fabs(y))] )
lim = ( int(xymax/binwidth) + 1) * binwidth

bins = np.arange(-lim, lim + binwidth, binwidth)
divider = make_axes_locatable(axScatter)
axHistx = divider.append_axes("top", 1.2, pad=0.1, sharex=axScatter)

bins = np.arange(-lim, lim + binwidth, binwidth)
axHistx.hist(x, bins=bins);

# <codecell>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120223/f7bd7c13/attachment.html 

More information about the IPython-User mailing list