diff --git a/examples/shapes_and_collections/hatch_style_reference.py b/examples/shapes_and_collections/hatch_style_reference.py index 9b36dca64210..a98bba0aabbb 100644 --- a/examples/shapes_and_collections/hatch_style_reference.py +++ b/examples/shapes_and_collections/hatch_style_reference.py @@ -9,7 +9,7 @@ import matplotlib.pyplot as plt from matplotlib.patches import Rectangle -fig, axs = plt.subplots(2, 5, constrained_layout=True, figsize=(10, 5)) +fig, axs = plt.subplots(2, 5, constrained_layout=True, figsize=(6.4, 3.2)) hatches = ['/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*'] @@ -20,6 +20,26 @@ def hatches_plot(ax, h): ax.axis('equal') ax.axis('off') +for ax, h in zip(axs.flat, hatches): + hatches_plot(ax, h) + +############################################################################### +# Hatching patterns can be repeated to increase the density. + +fig, axs = plt.subplots(2, 5, constrained_layout=True, figsize=(6.4, 3.2)) + +hatches = ['//', '\\\\', '||', '--', '++', 'xx', 'oo', 'OO', '..', '**'] + +for ax, h in zip(axs.flat, hatches): + hatches_plot(ax, h) + +############################################################################### +# Hatching patterns can be combined to create additional patterns. + +fig, axs = plt.subplots(2, 5, constrained_layout=True, figsize=(6.4, 3.2)) + +hatches = ['/o', '\\|', '|*', '-\\', '+o', 'x*', 'o-', 'O|', 'O.', '*-'] + for ax, h in zip(axs.flat, hatches): hatches_plot(ax, h)