1

I'm running Python 3.5.1 with matplotlib version 1.5.1 and iPython 5.0.0. I can't seem to get matplotlib's interactive feature working. I can run a command to create a plot:

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.plot([1,2,3])

This doesn't show a figure until I manually execute plt.show(), at which point iPython hangs until I close the figure window. I have interactive set to True in my matplotlibrc file.

It's been a year or so since I used matplotlib. The last time I used it, I got interactive without having to execute plt.show(). Has something changed or am I doing something wrong?

4
  • For those not too familiar with matplotlib, what do you mean by interactive. you want the console to "not freeze" after the plot shows? Or you expect to "interact" with the plot window somehow? And how? Commented Aug 12, 2016 at 17:08
  • 1
    @TasosPapastylianou It allows you to add data and manipulate the plot after it is created, by just continuing to use the object, and you should be able to see these changes dynamically on the figure window Commented Aug 12, 2016 at 17:09
  • there is an option you can pass to show() from what I remember, which stops it from freezing the console. I'll install the module and I'll let you know what it is, because I can't remember it by heart. Commented Aug 12, 2016 at 17:12
  • 1
    the argument is block. i.e. pyplot.show(block=False) Commented Aug 12, 2016 at 17:43

1 Answer 1

2

You were probably using interactive mode previously.

Start ipython with:

ipython --pylab

Then your plots will show up instantly.

Sign up to request clarification or add additional context in comments.

5 Comments

I wish this were the answer, so simple. However, it didn't appear to have any effect for me.
Works for me. What backend do you use? Try calling plt.ion() once you're in ipython.
--pylab is deprecated and clobbers namespaces! use --matplotlib
@PaulH I wasn't aware the option was deprecated, and quick googling couldn't find details of that, do you have a link?
turns out its not officially deprecated yet, but that's on the roadmap: stackoverflow.com/a/20528503/1552748 and mail.scipy.org/pipermail/ipython-dev/2014-March/013411.html. IPython and matplotlib devs alike really regret it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.