Skip to main contentSkip to solution

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.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question