9951 explained code solutions for 126 technologies


python-matplotlibHow to plot array


We can pass array directly to plot() method to plot its values:

import matplotlib.pyplot as plt

data = [2,3,5,1,1,3,6,7,2,2,1,4,5,6]

plt.plot(data)

plt.show()ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities

data =

declare sample array to plot

.plot(

plot specified data

.show()

render chart in a separate window