Ravindra Bagale · Data Scienceसर्व coursesया course चे lessonsशोधाEnglish

Data Science · मराठी आवृत्ती

14.3 hue आणि boxplot

रवींद्र बागले यांच्या course वर आधारित · सहज मराठीत explanation

hue="status" मुळे प्रत्येक city मधल्या statuses वेगळ्या colors मध्ये दिसतात:

fig, ax = plt.subplots(figsize=(8, 4))
sns.countplot(data=df, x="city", hue="status", ax=ax)
ax.set_title("City × status counts (fictional)")
plt.xticks(rotation=30, ha="right")
fig.tight_layout()
plt.show()

Amount चा spread पाहण्यासाठी boxplot वापरू:

fig, ax = plt.subplots()
sns.boxplot(data=df, x="festival", y="amount", ax=ax)
ax.set_title("Amount spread by festival (fictional)")
plt.show()

Jupyter मध्ये steps

  1. sns.set_theme(style="whitegrid") run करा.
  2. City चा countplot करा.
  3. Festival नुसार mean amount चा barplot करा.
  4. hue="status" असलेला countplot करा.
  5. तो chart figures/seaborn_city_status.png मध्ये save करा.

या छोट्या sample मध्ये Diwali mean amount जास्त दिसेल. Hue chart मध्ये Cancelled फक्त Kolhapur खाली दिसतो.