File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020import matplotlib .patches as patches
2121import matplotlib .path as path
2222
23- fig , axs = plt .subplots (1 )
24-
2523np .random .seed (19680801 ) # Fixing random state for reproducibility
2624
2725# histogram our data with numpy
4442# make a patch out of it, don't add a margin at y=0
4543patch = patches .PathPatch (barpath )
4644patch .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 ()
4949plt .show ()
5050
5151# %%
5252# Instead of creating a three-dimensional array and using
5353# `~.path.Path.make_compound_path_from_polys`, we could as well create the
5454# compound path directly using vertices and codes as shown below
5555
56- fig , axs = plt .subplots (1 )
5756nrects = len (left )
5857nverts = nrects * (1 + 3 + 1 )
5958verts = np .zeros ((nverts , 2 ))
7473# make a patch out of it, don't add a margin at y=0
7574patch = patches .PathPatch (barpath )
7675patch .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 ()
7980plt .show ()
8081
8182# %%
You can’t perform that action at this time.
0 commit comments