Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have an array that looks like this

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

If I say

import matplotlib.pyplot as plt
plt(cplr)

TypeError: 'module' object is not callable

How do I plot the contents of a numpy array?

question from:https://stackoverflow.com/questions/18423603/simple-plot-in-python-of-a-numpy-array

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
239 views
Welcome To Ask or Share your Answers For Others

1 Answer

matplotlib.pyplot is a module; the function to plot is matplotlib.pyplot.plot. Thus, you should do

plt.plot(cplr)
plt.show()

A good place to learn more about this would be to read a matplotlib tutorial.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...