matplotlib地块窗口不会出现 [英] matplotlib plot window won't appear

查看:287
本文介绍了matplotlib地块窗口不会出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在64位使用Python 2.7.3。我装了熊猫以及matplotlib 1.1.1,无论是64位。眼下,没有我的情节上演。试图从几个不同的dataframes密谋后,我沮丧地放弃了,并试图从下面的第一个例子<一href="http://pandas.pydata.org/pandas-docs/dev/visualization.html">http://pandas.pydata.org/pandas-docs/dev/visualization.html:

I'm using Python 2.7.3 in 64-bit. I installed pandas as well as matplotlib 1.1.1, both for 64-bit. Right now, none of my plots are showing. After attempting to plot from several different dataframes, I gave up in frustration and tried the following first example from http://pandas.pydata.org/pandas-docs/dev/visualization.html:

输入:

import matplotlib.pyplot as plt
ts = Series(randn(1000), index=date_range ('1/1/2000', periods=1000))
ts = ts.cumsum()
ts.plot()
pylab.show()

输出:

Axes(0.125,0.1;0.775x0.8)

和没有情节的窗口出现。我读过其他计算器线程建议我可能会丢失的DLL。有什么建议?

And no plot window appeared. Other StackOverflow threads I've read suggested I might be missing DLLs. Any suggestions?

推荐答案

我不相信这是大熊猫的问题都没有。

I'm not convinced this is a pandas issue at all.

确实

import matplotlib.pyplot as plt
plt.plot(range(10))
plt.show()

弹出一个阴谋?

bring up a plot?

如果不是:

你是怎么安装matplotlib?是不是从源代码还是你从一个包管理器/ pre的二进制安装呢?

How did you install matplotlib? Was it from source or did you install it from a package manager/pre-built binary?

我怀疑,如果你运行:

import matplotlib            
print matplotlib.rcParams['backend']

其结果将是一个非GUI后端(几乎肯定AGG的)。这意味着你没有合适的GUI工具包可用(我个人使用的Tkinter,这意味着我的后端被报告为TkAgg)。

The result will be a non-GUI backend (almost certainly "Agg"). This suggests you don't have a suitable GUI toolkit available (I personally use Tkinter which means my backend is reported as "TkAgg").

解决这个取决于你的操作系统,但如果你可以安装一个GUI库(Tkinter的,GTK,QT4,PySide,蜡质中的一个),那么 pyplot.show()应该有希望弹出一个窗口,供您。

The solution to this depends on your operating system, but if you can install a GUI library (one of Tkinter, GTK, QT4, PySide, Wx) then pyplot.show() should hopefully pop up a window for you.

心连心,

这篇关于matplotlib地块窗口不会出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆