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