Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b803891

Browse files
authored
Merge pull request #17921 from forrestm/Extend-hatch-reference
Added density and combination hatching examples
2 parents 6b2cecc + 6d7bcf4 commit b803891

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

examples/shapes_and_collections/hatch_style_reference.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import matplotlib.pyplot as plt
1010
from matplotlib.patches import Rectangle
1111

12-
fig, axs = plt.subplots(2, 5, constrained_layout=True, figsize=(10, 5))
12+
fig, axs = plt.subplots(2, 5, constrained_layout=True, figsize=(6.4, 3.2))
1313

1414
hatches = ['/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*']
1515

@@ -20,6 +20,26 @@ def hatches_plot(ax, h):
2020
ax.axis('equal')
2121
ax.axis('off')
2222

23+
for ax, h in zip(axs.flat, hatches):
24+
hatches_plot(ax, h)
25+
26+
###############################################################################
27+
# Hatching patterns can be repeated to increase the density.
28+
29+
fig, axs = plt.subplots(2, 5, constrained_layout=True, figsize=(6.4, 3.2))
30+
31+
hatches = ['//', '\\\\', '||', '--', '++', 'xx', 'oo', 'OO', '..', '**']
32+
33+
for ax, h in zip(axs.flat, hatches):
34+
hatches_plot(ax, h)
35+
36+
###############################################################################
37+
# Hatching patterns can be combined to create additional patterns.
38+
39+
fig, axs = plt.subplots(2, 5, constrained_layout=True, figsize=(6.4, 3.2))
40+
41+
hatches = ['/o', '\\|', '|*', '-\\', '+o', 'x*', 'o-', 'O|', 'O.', '*-']
42+
2343
for ax, h in zip(axs.flat, hatches):
2444
hatches_plot(ax, h)
2545

0 commit comments

Comments
 (0)