File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 20
20
import matplotlib .patches as patches
21
21
import matplotlib .path as path
22
22
23
- fig , axs = plt .subplots (2 )
23
+ fig , axs = plt .subplots (1 )
24
24
25
25
np .random .seed (19680801 ) # Fixing random state for reproducibility
26
26
44
44
# make a patch out of it, don't add a margin at y=0
45
45
patch = patches .PathPatch (barpath )
46
46
patch .sticky_edges .y [:] = [0 ]
47
- axs [0 ].add_patch (patch )
48
- axs [0 ].autoscale_view ()
47
+ axs .add_patch (patch )
48
+ axs .autoscale_view ()
49
+ plt .show ()
49
50
50
51
# %%
51
52
# Instead of creating a three-dimensional array and using
52
53
# `~.path.Path.make_compound_path_from_polys`, we could as well create the
53
54
# compound path directly using vertices and codes as shown below
54
55
56
+ fig , axs = plt .subplots (1 )
55
57
nrects = len (left )
56
58
nverts = nrects * (1 + 3 + 1 )
57
59
verts = np .zeros ((nverts , 2 ))
72
74
# make a patch out of it, don't add a margin at y=0
73
75
patch = patches .PathPatch (barpath )
74
76
patch .sticky_edges .y [:] = [0 ]
75
- axs [1 ].add_patch (patch )
76
- axs [1 ].autoscale_view ()
77
-
77
+ axs .add_patch (patch )
78
+ axs .autoscale_view ()
78
79
plt .show ()
79
80
80
81
# %%
You can’t perform that action at this time.
0 commit comments