Matplotlib is capable of drawing polygons with a hatched pattern, such as the one below, using the patch function. The key is in the “hatch=” parameter, in this case it is ‘/’ to add diagonal lines. According to the documentation it can also be one of these:
/ \ | - + x o O . *
Add a rectangle patch like this:
But what if you want a more dense hatch pattern? I stumbled across the answer, and it’s quite simple, just increase the characters in the hatch parameter. For example, use hatch=’//’ instead of a single hatch=’/’.
It also works with the other patterns, like hatch=’…’.
And you can combine different types, to make hatches that make you dizzy, such as hatch=’+/’.