# 19.2 matplotlib reference

Source: https://ravindrabagale.com/mr/datascience/ch19-cheat-sheet/19-2-matplotlib.html
Language: mr (Marathi with English technical terms)

x, y आणि values आधी तयार करा. Bar, line आणि hist या वेगवेगळ्या chart examples आहेत; गरजेनुसार एक निवडा.

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()

figures folder तयार असावा. Labels मध्ये अर्थपूर्ण नावं आणि units भरा; “...” तसंच ठेवू नका.

रवींद्र बागले यांची tip

एका chart नंतर दुसरा स्वतंत्र chart करायचा असेल तर नवीन fig, ax तयार करा. त्यामुळे जुने plots मिसळत नाहीत.
