Ravindra BagaleCourses & study guides Track your progress

Guides

matplotlib और seaborn से पहले charts (line, bar, hist)

Read this guide in: English · मराठी · हिंदी

आपके पहले bar, line और histogram charts tables को stories बनाते हैं। matplotlib और seaborn इस्तेमाल करो। Shop: Mumbai bar 120, Pune 70. Machine learning नहीं।

दोस्तों! Managers pictures याद रखते हैं। आज ईमानदार पहले charts — rank के लिए bar, trend के लिए line, distribution के लिए hist। Labels साफ़। समझा?

संक्षिप्त उत्तर

खड़ा first-chart path:

  1. matplotlib.pyplot और seaborn import।
  2. Aggregated table से शुरू (ज़रूरत हो तो groupby)।
  3. Bar — cities / clients compare।
  4. Line — dates हों तो trend।
  5. Hist — likes या watches की distribution।
  6. Title + axis labels + एक वाक्य takeaway।
question → aggregate → bar/line/hist → label → one message

Language: English · मराठी · हिंदी

इस guide से पहले क्या चाहिए?

  • Clean-enough DataFrame और साफ़ सवाल।
  • Packages: matplotlib, seaborn।
  • Course: Line and hist.

Before और after

Before charts Sales table without a chart.

Before — shop sales as numbers only.

After first bar Bar chart story; Mumbai 120.

After — first bar chart; Mumbai bar taller at 120.

Before: सिर्फ़ numbers। After: bar story — Mumbai ऊँचा 120.

matplotlib vs seaborn

matplotlib = foundation। seaborn = pandas पर तेज़ statistical charts। दोनों इस्तेमाल करो।

Bar — shop sales

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

df = pd.DataFrame({"city": ["Mumbai", "Pune"], "sales": [120, 70]})

sns.barplot(data=df, x="city", y="sales")
plt.title("Shop sales by city")
plt.ylabel("Sales")
plt.show()

बोलो: “Mumbai 120 vs Pune 70 से आगे।”

Line — daily trend

daily = pd.DataFrame({"day": [1, 2, 3], "sales": [40, 50, 100]})
plt.plot(daily["day"], daily["sales"], marker="o")
plt.title("Online sales trend")
plt.show()

Hist — Instagram-like likes

likes = pd.Series([80, 40, 70, 30, 90, 20])
plt.hist(likes, bins=5)
plt.title("Distribution of post likes")
plt.show()

Spread दिखाता है — विजेता नहीं।

Chart ↔ सवाल

सवाल Chart
किसने ज़्यादा बेचा? Bar
दिन‑दर‑दिन sales कैसे चली? Line
likes कैसे फैले? Hist

Storytelling

एक chart = एक message। Axes label। Chart junk से बचो। Line-item rows हो तो plot से पहले aggregate।

Mini story

सवाल → Mumbai 120 / Pune 70 → bar → वाक्य → optional Online filter redraw।

Ravindra Bagale's Tip

Takeaway एक बोले गए वाक्य में न आ सके तो chart तैयार नहीं — पहले aggregation या title ठीक करो। समझा?

Practice task

  1. Bar plot Mumbai 120 / Pune 70.
  2. Markdown takeaway।
  3. छह likes का hist।
  4. “कौन जीता?” vs “spread कैसा?” — कौन‑सा chart।

Samajla ka? Rank के लिए bar, trend के लिए line, spread के लिए hist। Label। Message बोलो। Mumbai 120 साफ़ दिखे। अब आगे चलें।

Frequently asked questions

matplotlib vs seaborn?

matplotlib is the base. seaborn gives faster statistical charts. Use both; the course compares them.

Which chart first?

Bar for category comparison. Line for time. Hist for distribution of one numeric column.

My bars look wrong

Check aggregation — plot groupby totals, not duplicated raw rows by mistake.

Do I need colour fireworks?

No. Clear labels beat neon themes in interviews and client work.

Where does storytelling fit?

Match chart to question — course chapter 15. One page, one manager message.

Course links?

matplotlib line/hist, seaborn bar/count, chart choice chapters.