matplotlib 中没有绘图窗口 [英] No plot window in matplotlib

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

问题描述

我刚刚使用突触包系统在 Ubuntu 9.10 中安装了 matplotlib.但是,当我尝试以下简单示例时

<预><代码>>>>从 pylab 导入图;>>>情节([1,2,3],[1,2,3])[]

我没有绘图窗口.关于如何显示绘图窗口的任何想法?

解决方案

您可以输入

导入pylabpylab.show()

或者更好,使用 ipython -pylab.

<小时>

自从使用pylab 不再推荐,现在的解决方案是

将 matplotlib.pyplot 导入为 pltplt.plot([1,2,3])plt.show()

I just installed matplotlib in Ubuntu 9.10 using the synaptic package system. However, when I try the following simple example

>>> from pylab import plot;
>>> plot([1,2,3],[1,2,3])
[<matplotlib.lines.Line2D object at 0x9aa78ec>]

I get no plot window. Any ideas on how to get the plot window to show?

解决方案

You can type

import pylab
pylab.show()

or better, use ipython -pylab.


Since the use of pylab is not recommended anymore, the solution would nowadays be

import matplotlib.pyplot as plt

plt.plot([1,2,3])

plt.show()

这篇关于matplotlib 中没有绘图窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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