Skip to content
Exercises · Q14

Q.Collect the minimum and maximum temperature of your city for a month and present it using a histogram plot.

Yanam CbseNCERTSubjective· 3mImportance★★★★★
80% · 35/44 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

A histogram is the wrong chart for this data — you need a dual-line plot or a grouped bar chart to show min and max temperatures over time. A histogram shows frequency distribution, not time trends.

Why a histogram is the wrong choice here

Let's think about what a histogram actually does. A histogram takes a single numerical variable and shows how often values fall into different bins (ranges). For example, "how many days had a temperature between 20°C and 25°C?" That's a frequency distribution.

Your data, however, has two variables (min temp and max temp) changing over time (each day of the month). You want to see the trend — how temperatures rise and fall day by day. A histogram cannot show that. It would just tell you "most days had a max around 30°C" but you'd lose all information about which day was which.

Watch out

This is a classic mistake in data visualization: using a histogram when you actually need a time-series plot. A histogram bins data and discards the time order — exactly what you don't want here.

What you should actually plot

For daily min and max temperatures over a month, the right chart is a dual-line plot (or a grouped bar chart if you prefer bars). Here's the code:

import matplotlib.pyplot as plt
import numpy as np

# Sample data: 30 days of temperatures (replace with your actual city data)
days = np.arange(1, 31)
min_temps = [18, 19, 17, 20, 21, 19, 18, 22, 23, 21, 20, 19, 18, 17, 20, 
             22, 24, 23, 21, 20, 19, 18, 17, 19, 21, 23, 25, 24, 22, 20]
max_temps = [30, 31, 29, 32, 33, 31, 30, 34, 35, 33, 32, 31, 30, 29, 32, 
             34, 36, 35, 33, 32, 31, 30, 29, 31, 33, 35, 37, 36, 34, 32]

plt.figure(figsize=(12, 6))
plt.plot(days, min_temps, 'b-o', label='Min Temperature', linewidth=2)
plt.plot(days, max_temps, 'r-o', label='Max Temperature', linewidth=2)
plt.xlabel('Day of Month')
plt.ylabel('Temperature (°C)')
plt.title('Daily Min and Max Temperatures for [Your City] — [Month]')
plt.legend()
plt.grid(True, alpha=0.3)
plt.xticks(days)
plt.tight_layout()
plt.show()

What this shows:

  • X-axis: day of the month (1 to 30)
  • Y-axis: temperature in °C
  • Blue line with circles: minimum temperature each day
  • Red line with circles: maximum temperature each day
  • You can instantly see trends, cold snaps, heat waves, and the daily temperature range
Tip

If your teacher specifically asks for a histogram (perhaps to show the distribution of temperatures), then you'd make two separate histograms — one for min temps and one for max temps — but that answers a different question: "how are the temperatures distributed?" not "how do they change over time?"

If you absolutely must make a histogram (as the question asks)

If the question forces a histogram, here's how you'd do it — but understand it's answering a different question:

import matplotlib.pyplot as plt
import numpy as np

# Same data as above
min_temps = [18, 19, 17, 20, 21, 19, 18, 22, 23, 21, 20, 19, 18, 17, 20, 
             22, 24, 23, 21, 20, 19, 18, 17, 19, 21, 23, 25, 24, 22, 20]
max_temps = [30, 31, 29, 32, 33, 31, 30, 34, 35, 33, 32, 31, 30, 29, 32, …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.