9
9
import matplotlib .pyplot as plt
10
10
from matplotlib .patches import Rectangle
11
11
12
- fig , axs = plt .subplots (2 , 5 , constrained_layout = True , figsize = (9 , 4.5 ))
12
+ fig , axs = plt .subplots (2 , 5 , constrained_layout = True , figsize = (6.4 , 3.2 ))
13
13
14
14
hatches = ['/' , '\\ ' , '|' , '-' , '+' , 'x' , 'o' , 'O' , '.' , '*' ]
15
15
@@ -26,33 +26,19 @@ def hatches_plot(ax, h):
26
26
###############################################################################
27
27
# Hatching patterns can be repeated to increase the density.
28
28
29
- fig , axs = plt .subplots (2 , 5 , constrained_layout = True , figsize = (9 , 4.5 ))
29
+ fig , axs = plt .subplots (2 , 5 , constrained_layout = True , figsize = (6.4 , 3.2 ))
30
30
31
31
hatches = ['//' , '\\ \\ ' , '||' , '--' , '++' , 'xx' , 'oo' , 'OO' , '..' , '**' ]
32
32
33
-
34
- def hatches_plot (ax , h ):
35
- ax .add_patch (Rectangle ((0 , 0 ), 2 , 2 , fill = False , hatch = h ))
36
- ax .text (1 , - 0.5 , f"' { h } '" , size = 15 , ha = "center" )
37
- ax .axis ('equal' )
38
- ax .axis ('off' )
39
-
40
33
for ax , h in zip (axs .flat , hatches ):
41
34
hatches_plot (ax , h )
42
35
43
36
###############################################################################
44
37
# Hatching patterns can be combined to create additional patterns.
45
38
46
- fig , axs = plt .subplots (2 , 5 , constrained_layout = True , figsize = (9 , 4.5 ))
39
+ fig , axs = plt .subplots (2 , 5 , constrained_layout = True , figsize = (6.4 , 3.2 ))
47
40
48
- hatches = ['//' , '\\ \\ ' , '||' , '--' , '++' , 'xx' , 'oo' , 'OO' , '..' , '**' ]
49
-
50
-
51
- def hatches_plot (ax , h ):
52
- ax .add_patch (Rectangle ((0 , 0 ), 2 , 2 , fill = False , hatch = h ))
53
- ax .text (1 , - 0.5 , f"' { h } '" , size = 15 , ha = "center" )
54
- ax .axis ('equal' )
55
- ax .axis ('off' )
41
+ hatches = ['/o' , '\\ |' , '|*' , '-\\ ' , '+o' , 'x*' , 'o-' , 'O|' , 'O.' , '*-' ]
56
42
57
43
for ax , h in zip (axs .flat , hatches ):
58
44
hatches_plot (ax , h )
0 commit comments