5.2 The Matplotlib Library
Matplotlib.pyplot is a graph plotting software library in python that serves as a visualization utility. matplotlib.pyplot is typically imported with the alias plt.
Matplotlib.pyplot Functions
| Function | Description |
|---|---|
plt.bar(x,y)
| Bar Graph |
plt.pie(y,labels=x)
| Pie Chart |
plt.hist(x,bins=k)
| Histogram with k classes |
plt.scatter(x,y)
| Scatter Plot |
plt.suptitle("Main Title")
| Main Title |
plt.xlabel("Horizontal Title")
| Horizontal Label |
plt.ylabel("Vertical Title")
| Vertical Label |
Adapted from Python for Introductory Statistics, by Simon Aman (Truman College, City Colleges of Chicago), licensed under CC BY 4.0. Changes were made: reformatted as an accessible XYZ web edition with live in-browser code cells. License: CC-BY-4.0.