[IPython-User] [notebook] set axis limits after inline plot?
Thu Dec 13 13:52:02 CST 2012
On 12/13/2012 05:23 AM, Thomas Kluyver wrote:
> On 13 December 2012 00:29, Michael Aye <firstname.lastname@example.org
> <mailto:email@example.com>> wrote:
> is it possible when using --pylab=inline option to change, for
> the x-axis limits of a plot already displayed?
> I tried to catch the axis object:
> In : ax
> Out: <matplotlib.axes.AxesSubplot at 0x111e30690>
> and then set it using ax.set_xlim() and a draw() but I guess the
> results of that don't communicate back to the already inline displayed
> plot in the notebook?
> No, for now, once the plot is displayed, it's essentially a static
> image, and the only way to change it is to recreate it. The matplotlib
> developers have some ideas about how to have interactive plots in the
> notebook, but it's not in place yet.
One approach is to store the figure and axes into variables, and then
manipulate and redisplay them in a subsequent cell:
fig, ax = subplots()
plot(linspace(-pi, pi, 100), sin(linspace(-pi, pi, 100)))
Out: <plot with x limits at -pi to pi>
Out: <plot with x limits at -1 to 1>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-User