19. Cheat Sheet
19.2 matplotlib
By Ravindra Bagale · Last updated:
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(8, 4))
ax.bar(x, y)
ax.plot(x, y, marker="o")
ax.hist(values, bins=10)
ax.set_title("..."); ax.set_xlabel("..."); ax.set_ylabel("...")
plt.xticks(rotation=30, ha="right")
fig.tight_layout()
fig.savefig("figures/chart.png", dpi=120)
plt.show()