RBSE SS Informatics Practices study materials
RBSE SS Informatics Practices study resources

Three Questions, Three Wrong Charts

RBSE SS Informatics Practices · Put your knowledge to work in context.

All case studies

Three Questions, Three Wrong Charts

A student analysing her survey of 240 classmates must answer three questions for her project report: (i) is there a relationship between daily study hours and marks scored, (ii) how are the marks distributed across the class, and (iii) how did the average attendance of her class change from April to March. Her current figures are: plt.bar(hours, marks) for (i), which produces a dense wall of 240 bars; plt.plot(marks) for (ii), a jagged line that reveals nothing about shape; and a bar chart of the 12 months for (iii). None of the three has a title, an x-axis label or a y-axis label, and the month names on the third chart overlap into an unreadable smear. Her script ends with plt.show() followed by plt.savefig('attendance.png'), and the saved file is a blank white image. She also notes that the class average is 58 while the median is 64, and that the histogram tail points towards the low marks. The examiner must be able to read each chart without her standing beside it.

1. Select the correct plot for each of the three questions and justify each choice in terms of the data type and the question asked.

Read the worked answer

(i) Scatter - plt.scatter(hours, marks). Both variables are quantitative and the question is about the relationship between a pair of measurements; each student becomes one point, and a trend, a cluster or an outlier is visible. A bar chart here is a category chart misused: with 240 bars the eye compares bar heights instead of seeing the joint pattern, and many students share the same hours value.

(ii) Histogram - plt.hist(marks, bins=10). The question is about the shape of one quantitative variable's distribution: centre, spread, skew and gaps. A line plot of raw marks in row order plots the order of the rows, which is meaningless - it looks like a time series of nothing. The bin count is a judgement call: too few hides the shape, too many turns it into noise, so try 8 to 12 and state the choice.

(iii) Line - plt.plot(months, avg_attendance). Month is an ordered sequence and the question is about change over time, which is exactly what a line implies. Bars would treat the months as unrelated categories and lose the sense of trend. Bars are for comparing separate categories, such as average marks across the five sections.

2. Explain why the saved PNG is blank and how to fix the missing titles and overlapping labels.

Read the worked answer

plt.show() renders the current figure and then, in the common non-interactive backends, destroys the figure that savefig would have used. Calling savefig afterwards writes an empty canvas. Two fixes: call plt.savefig('attendance.png', dpi=150, bbox_inches='tight') before plt.show(); or hold the figure object explicitly - fig, ax = plt.subplots() ... fig.savefig('attendance.png') - which is unaffected by show().

Labelling is not decoration; an unlabelled chart is unreadable. The minimum is plt.title('...'), plt.xlabel('Daily study hours'), plt.ylabel('Marks (out of 100)'), and on the attendance chart plt.xticks(rotation=45) or plt.figure(figsize=(9,4)) so twelve month names fit. Use plt.legend() whenever two series share axes.

A second trap is mixing interfaces: plt.plot (stateful) and ax.plot (object) in one script can send a label to the wrong axes, so pick one style per figure. Fix order: build the figure, label it, save it, then show it.

3. The marks histogram has a long tail towards the low marks, with mean 58 and median 64. What should the report say, and what should the school do?

Read the worked answer

A tail towards the low end means the distribution is negatively (left) skewed: a small number of very low scores pull the mean below the median. The reasoning is that the mean uses every value, so a handful of scores near 20 drag it down, while the median only marks the middle position and stays at 64. Neither number is wrong; they answer different questions. If the report says 'the class average is 58' it implies the typical student scored 58, which the median contradicts.

The defensible statement is: 'Median marks 64, mean 58; the mean is lowered by a small group of very low scores. Half the class scored 64 or more.' Quoting the median with the mean and explaining the gap is exactly the interpretation a histogram is meant to support.

The follow-up matters more than the statistic. A long low tail is not a normal spread - it points to a specific group in difficulty, so the school should identify those students and check whether the cause is attendance, a language barrier or a topic-level gap, rather than shifting the whole class's teaching. Reporting only the mean would have hidden those students entirely.