Using ion() from pylab causes matplotlib to hang

倖福魔咒の 提交于 2019-12-25 06:55:56

问题


I'm using Enthought's 32 bit python distribution for mac.

If I try:

$ ipython
In [1] from pylab import *
In [2] ion()
In [3] plot([1,2],[1,2])

The figure is created, but python freezes while trying to plot.

Am I doing something wrong or is this a bug?

plotting by running in ipython --pylab works fine


回答1:


I was using the 'WXAgg' backend and I switched to 'macosx' this seems to fix the problem

In [1]: import matplotlib

In [2]: matplotlib.get_backend()
Out[2]: 'WXAgg'

In [3]: matplotlib.use('macosx')

In [4]: matplotlib.get_backend()
Out[4]: 'MacOSX'

In [5]: from pylab import *

In [6]: ion()

In [7]: plot([1,2]) # now works fine


来源:https://stackoverflow.com/questions/12827969/using-ion-from-pylab-causes-matplotlib-to-hang

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