【发布时间】:2014-05-25 19:46:32
【问题描述】:
我已经阅读了这些并尝试了解决方案,但仍然没有得到任何显示:
matplotlib show nothing although i called show
Why doesn't pyplot.show() work? [duplicate]
matplotlib does not show my drawings although I call pyplot.show()
我在 Ubuntu 12.04 上使用 Python 2.7.6 |Anaconda 1.9.0(64 位)。 我该如何诊断问题并尝试解决它?
编辑:
-首先我编辑了matplotlibrc并将后端更改为GtkAgg(设置为QtAgg)。
-然后我尝试通过代码更改后端:matplotlib.rcParams['backend'] = "GtkAgg"
EDIT2 - 从 Spyder 控制台添加细节(最后没有显示图):
Python 2.7.6 |Anaconda 1.9.0 (64-bit)| (default, Jan 17 2014, 10:13:17)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Imported NumPy 1.8.0, SciPy 0.13.3, Matplotlib 1.3.1
Type "scientific" for more details.
>>> scientific
This is a standard Python interpreter with preloaded tools for scientific
computing and visualization. It tries to import the following modules:
>>> import numpy as np # NumPy (multidimensional arrays, linear algebra, ...)
>>> import scipy as sp # SciPy (signal and image processing library)
>>> import matplotlib as mpl # Matplotlib (2D/3D plotting library)
>>> import matplotlib.pyplot as plt # Matplotlib's pyplot: MATLAB-like syntax
>>> from pylab import * # Matplotlib's pylab interface
>>> ion() # Turned on Matplotlib's interactive mode
Within Spyder, this interpreter also provides:
* special commands (e.g. %ls, %pwd, %clear)
* system commands, i.e. all commands starting with '!' are subprocessed
(e.g. !dir on Windows or !ls on Linux, and so on)
>>> plot(range(3))
[<matplotlib.lines.Line2D object at 0x3f3cd50>]
>>> show()
【问题讨论】:
-
你到底尝试了什么?什么后端等等?
-
什么平台?你在尝试 IPython 笔记本吗?您收到任何错误消息吗?
-
我在 Ubuntu 12.04 上使用 Anaconda 1.9.0。我在 W7 机器上使用相同的 Anaconda,绘图工作得很好。不尝试使用 IPython。需要 Spyder 的绘图。
-
你安装了 pygtk 吗?
-
不熟悉。除非它与 Anaconda 一起提供,否则我不会拥有它。
标签: python-2.7 matplotlib ubuntu-12.04