logo

... matplotlib: plot types



Notes

The you want to make a scatter chart you can run;

import numpy as np
import matplotlib.pylab as plt

x = np.linspace(0, 1, 20)
y = x ** 2
plt.scatter(x, y);

The you want to make a histogram you can run;

import numpy as np
import matplotlib.pylab as plt

x = np.linspace(0, 1, 100)
y = x ** 2
plt.hist(y, bins=30);

Note the semi-colon at the end here.

Feedback? See an issue? Something unclear? Feel free to mention it here.



If you want to be kept up to date, consider signing up for the newsletter.