【问题标题】:Simple plot in python of a numpy array?python中numpy数组的简单绘图?
【发布时间】:2013-08-27 17:33:03
【问题描述】:

我有一个看起来像这样的数组

cplr = array([ 0.01828922,  0.01972157,  0.02342053, ...,  0.25928021,
    0.26352547,  0.26883406])

如果我说

import matplotlib.pyplot as plt
plt(cplr)

TypeError: 'module' 对象不可调用

如何绘制 numpy 数组的内容?

【问题讨论】:

    标签: python-2.7 numpy


    【解决方案1】:

    matplotlib.pyplot 是一个模块;要绘制的函数是matplotlib.pyplot.plot。因此,你应该这样做

    plt.plot(cplr)
    plt.show()
    

    阅读matplotlib tutorial 是一个了解更多信息的好地方。

    【讨论】:

    • 现在我进入 [66]: plt.plot(cplr) Out[66]: [] 并且没有出现任何情节?
    • 之后你必须使用plt.show()。你读过a tutorial吗?
    猜你喜欢
    • 2021-05-05
    • 2019-06-24
    • 2017-03-14
    • 1970-01-01
    • 1970-01-01
    • 2021-05-02
    • 1970-01-01
    • 1970-01-01
    • 2016-12-11
    相关资源
    最近更新 更多