9951 explained code solutions for 126 technologies

python-matplotlibHow to plot Numpy data

We cam pass Numpy arrays directly to plot() method:

import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(-5, 15, 50)

plt.plot(x, x**2)

plt.show()ctrl + c
import numpy as np

load Numpy module for Python

import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities


generate random values based on specified range and count


plot specified data


render chart in a separate window