62

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?

asked Aug 24, 2013 at 22:07

1 Answer 1

86

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.

quant
23.6k39 gold badges134 silver badges233 bronze badges
answered Aug 24, 2013 at 22:10
Sign up to request clarification or add additional context in comments.

2 Comments

Now I get In [66]: plt.plot(cplr) Out[66]: [<matplotlib.lines.Line2D at 0x1077fdad0>] and no plot appears?
You might need plt.show(block=True) depending on your matplotlib backend.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.