Matplotlib.Pyplot does not show output; No Error

前端 未结 3 2053
不思量自难忘°
不思量自难忘° 2020-12-16 01:06

My platform is as follows

Centos 6.x (VirtualBox VM running on Win-7 host), Python 2.6.6, Matplotlib 1.3.1, Numpy 1.8.0, Scipy 0.14.0.dev-bb608ba

I am runnin

相关标签:
3条回答
  • 2020-12-16 01:42

    The first step in debugging this is to replace plt.show() by plt.savefig('foo.png'). If it works, the problem is most probably with the backend:

    >>> import matplotlib
    >>> matplotlib.get_backend()
    'Qt4Agg'
    

    Try switching backends and see if that helps: How to switch backends in matplotlib / Python

    If that does not help either, make sure you have all the dependencies (http://matplotlib.org/users/installing.html) --- I'd just reinstall from source. (not pip install matplotlib)

    0 讨论(0)
  • 2020-12-16 01:45

    I once had a similar problem. I solved it by adding these lines imediately after import matplotlib.pyplot as plt and after every subsequent plt.show():

    plt.clf()
    plt.cla()
    plt.close()
    
    0 讨论(0)
  • 2020-12-16 01:47

    I am having the exact same problem. However, this was my fix after a little bit of research:

    sudo yum install PyQt4
    sudo gedit file at mpl.matplotlib_fname()
    

    Change the first and only uncommented setting (as default) at line 32:

    backend : Qt4Agg
    
    0 讨论(0)
提交回复
热议问题