Question:medium

Which property can be used to fill to each hist with pattern in histogram?

Show Hint

Hatching uses characters like slashes or dots to add patterns.
It is useful for creating accessible, black-and-white friendly visualizations.
Updated On: Jun 11, 2026
  • explode
  • fill
  • patch
  • hatch
Show Solution

The Correct Option is D

Solution and Explanation


Step 1: Understanding the Question:

The question asks which property or parameter in Matplotlib plotting (such as histograms) is used to fill the bars with a pattern (like stripes, dots, or cross-hatching) instead of a solid color.

Step 2: Key Formula or Approach:

In Python's Matplotlib library, the hatch parameter is used to apply fill patterns to patches (including bars in bar charts and histograms).
The pattern is specified as a string containing characters like '/', '
', '|', '-', '+', 'x', 'o', 'O', '.', '*'.

Step 3: Detailed Explanation:

When visualizing data using histograms via plt.hist(), each bar is represented by a rectangle patch.
By default, these patches are filled with a solid color.
To distinguish between multiple distributions in black-and-white printing or for better accessibility, we can apply cross-hatching patterns using the hatch keyword argument.
For example: plt.hist(data, hatch='/') will fill the bars with diagonal stripes.
Let's analyze the other options:
- explode is used in pie charts to separate a slice from the center.
- fill is a boolean property indicating whether to fill the patch with color.
- patch is the class of shape objects but not a pattern property itself.
Thus, hatch is the correct property.

Step 4: Final Answer:

The correct option is (D), which is hatch.
Was this answer helpful?
0


Questions Asked in CUET (UG) exam