Which property can be used to fill to each hist with pattern in histogram?
Which property can be used to fill to each hist with pattern in histogram?
Solution
✅ Correct Option: 4
In Matplotlib, the hatch property sets a pattern on a patch. Each histogram bar is a patch, so plt.hist(data, hatch='/') fills the bars with diagonal lines.
Other patterns include '\\', 'x', 'o', '.' and '*'.
Option 1: explode is used in pie charts to pull a wedge out from the centre, not in histograms.
Option 2: fill only switches colour filling on or off (fill=False gives hollow bars). It does not choose a pattern.
Option 3: patch is the type of object a bar is, not a property that sets a pattern.
Related questions:
2025: 21 May Shift 1
2026: 21 May Shift 1
2025: 30 May Shift 2