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?
For plotting graphs in Python, we will use the Matplotlib library. Matplotlib is used along with NumPy data to plot any type of graph. From matplotlib we use the specific function i.e. pyplot(), which is used to plot two-dimensional data.
The plot() function is used to draw points (markers) in a diagram. By default, the plot() function draws a line from point to point. The function takes parameters for specifying points in the diagram.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With