Les om Matplotlib her:
For hvert eksempel kan man laste ned et Jupyter Notebook-dokument og bruke som utgangspunkt for egne plott.
import matplotlib.pyplot as plt
Vil lage et plott av funksjonen
$f(x) = x² $
for området $[-10, 10]$
Metode:
X = list(range(-10, 11))
print(X)
Y = []
for x in X:
Y.append(x**2)
print(Y)
plt.plot(X, Y)
plt.show()
plt.plot(X, Y)
plt.axis([-11, 11, -10, 110])
plt.xlabel('x')
plt.ylabel('y')
plt.grid(True)
plt.show()
plt.plot(X, Y, 'o') # o, ., x, X, etc
plt.axis([-11, 11, -10, 110])
plt.xlabel('x')
plt.ylabel('y')
plt.grid(True)
plt.show()