简体   繁体   English

无法使用matplotlib绘图

[英]Cannot plot using matplotlib

I wrote the code below, but when I run the code I get the error: 我编写了下面的代码,但是当我运行代码时出现错误:

TypeError: 'module' object is not callable 

my code is: 我的代码是:

import numpy as np
import matplotlib as plt

n = 10

aa = [float(i) for i in range(1, n)]
a = np.squeeze(np.asarray(range(1, n)))
bb = -0.8*np.exp(-a/1.4) + 1.4*np.exp(-a/2.0) + 0.4*np.exp(-a/3.0)
b = np.squeeze(np.asarray(bb))

plt.figure()
plt.scatter(a, b)# I used different combinations of a, aa, bb and b. None of them worked.
plt.show()

您需要导入行:

import matplotlib.pyplot as plt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM