Ravindra BagaleCourses & study guides

13. Visualization with matplotlib

13.2 Line and Hist

# Fictional daily orders in Pune around Diwali
days = list(range(1, 11))
orders = [180, 190, 210, 250, 900, 880, 400, 220, 200, 190]

fig, ax = plt.subplots()
ax.plot(days, orders, marker="o")
ax.set_title("Pune daily orders (fictional) — Diwali spike")
ax.set_xlabel("Day of October 2026")
ax.set_ylabel("Orders")
ax.axhline(500, linestyle="--", label="Spike threshold")
ax.legend()
plt.show()
mins = [9, 12, 11, 14, 18, 10, 8, 13, 16, 17, 11, 9]
fig, ax = plt.subplots()
ax.hist(mins, bins=5)
ax.set_title("Delivery minutes distribution (fictional sample)")
ax.set_xlabel("Minutes")
ax.set_ylabel("Count")
plt.show()

Steps in Jupyter

  1. Plot the city GMV bar chart.
  2. Rotate x labels so Sambhaji Nagar is readable.
  3. Plot the Diwali line chart with a threshold line.
  4. Save: fig.savefig("figures/pune_diwali.png", dpi=120).

What you should see. Clear spike on days 5–6; PNG appears in figures/.

Ravindra Bagale's Tip

Khup students chart save nahi kartat aani screenshot kadtat — quality kharab, reproduction nahi. savefig PNG habit taka. Site var PDF link nahi — PNG/JPG OK for your own reports. Bilkul visru naka.