Why doesn't the save button work on a matplotlib plot?

前端 未结 4 933
野性不改
野性不改 2020-12-09 05:18

I have matplotlib 1.0.0 installed in a Python 2.7 virtualenv on Mac OS X 10.6. I can create plots fine. However, whenever I press the Save button, I can\'t type tex

相关标签:
4条回答
  • 2020-12-09 06:02

    For those that Thouis method didn't work:

    I noticed that a simple work around is to change matplotlib backend. Here is a list of available backends:

    http://matplotlib.org/faq/usage_faq.html#what-is-a-backend

    Note that you should choose one of the renderer ones (i.e. the ones that support show() command). You might need to install the backend, but you might have multiple ones installed.

    To do so:

    import matplotlib
    matplotlib.use('Qt4Agg')    #replace 'Qt4Agg' with desired backend
    

    Warning: This should be done BEFORE importing pylab, etc.

    0 讨论(0)
  • 2020-12-09 06:07

    My answer doesn't fix the problem but can workaround it easily! You can touch a new file with the correct file extension in a terminal. After you can choose this file with the mouse inside the matplotlib window and overwrite it.

    0 讨论(0)
  • 2020-12-09 06:09

    You need to convince OSX that the virtualenv is actually running from an Application Bundle. Fix discussed here:

    http://groups.google.com/group/python-virtualenv/browse_thread/thread/83fa4a12d22a30c8/744e19c194f1618a

    And implemented here:

    https://github.com/gldnspud/virtualenv-pythonw-osx

    0 讨论(0)
  • 2020-12-09 06:14

    To solve this:

    Use conda install python.app to install pythonw.

    Then use pythonw instead of python in your terminal.

    E.g.

    pythonw my_plot.py
    

    Hope this helps

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