Avoiding <matplotlib.figure.Figure at 0xeafea58>

谁说胖子不能爱 提交于 2019-12-13 16:18:34

问题


I am trying to plot a series of functions on the same graphs. The code seems to run ok, but there is no picture coming coming out. just simply

<matplotlib.figure.Figure at 0xeafea58>

How can it be fixed?


回答1:


In the IPython console, the best way to make sure figures show up (without explicitly calling plt.show()) is to use %matplotlib mode. If matplotlib is installed correctly, it should automatically choose a suitable backend for your system.

For example:

In [1]: import matplotlib.pyplot as plt

In [2]: plt.plot([1, 2, 3])  # no plot shown!
Out[2]: [<matplotlib.lines.Line2D at 0x110eac898>]

In [3]: %matplotlib
Using matplotlib backend: MacOSX

In [4]: plt.plot([1, 2, 3])  # plot shown now
Out[4]: [<matplotlib.lines.Line2D at 0x112174400>]

The %matplotlib magic command only needs to be entered once per session.



来源:https://stackoverflow.com/questions/43504109/avoiding-matplotlib-figure-figure-at-0xeafea58

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!