First of all, I am working on the Pycharm debug console and want to put a caption under my diagram. According to this answer this can be achieved by:
plt.plot([2,5,1,2]
fig = plt.figure()
fig.text(.5, .05, "text", ha="center")
plt.show()
However, this shows me the plot at first, then an empty window (after typing the second line) and nothing later.
I figured out this must be because of interactive mode of matplotlib so I turned it off using plt.ioff()
in the debug session after which plt.isinteractive()
returns False
. Still this does not change its behaviour and shows the plot right after the plt.plot(...)
command.
Weirdly enough when I put plt.ioff()
in my script, it is ignored and plt.isinteractive()
returns True
.
import matplotlib.pyplot as plt
plt.ioff()
plt.plot([1,2,3,4,5])
print(plt.isinteractive())
My system information:
- PyCharm CE 2017.3.2
- macOS Sierra 10.12.6
- Python 3.6.3 in an Anaconda Environment
Can anyone reproduce this? Is there another way to create more complicated diagrams from the Pycharm debug console? I would prefer to not change my development environment everytime I want to plot something more complicated.
plt.plot(...)
nor withplt.plot(...)
andplt.show()
. Executing my test file (withoutmatplotlib.use('Agg')
) from the bash works as expected: it displays the plots afterplt.show()
and I can even do interactive plotting with pdb. – Personality