File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
galleries/users_explain/artists Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 1818could use this code:
1919"""
2020
21+ import numpy as np
22+
2123import matplotlib .pyplot as plt
2224
2325import matplotlib .patches as patches
191193# edgecolor='yellow', alpha=0.5)
192194# ax.add_patch(patch)
193195
194- import numpy as np
195-
196- import matplotlib .patches as patches
197- import matplotlib .path as path
198-
199196fig , ax = plt .subplots ()
200197# Fixing random state for reproducibility
201198np .random .seed (19680801 )
213210
214211nverts = nrects * (1 + 3 + 1 )
215212verts = np .zeros ((nverts , 2 ))
216- codes = np .ones (nverts , int ) * path . Path .LINETO
217- codes [0 ::5 ] = path . Path .MOVETO
218- codes [4 ::5 ] = path . Path .CLOSEPOLY
213+ codes = np .full (nverts , Path .LINETO , dtype = int )
214+ codes [0 ::5 ] = Path .MOVETO
215+ codes [4 ::5 ] = Path .CLOSEPOLY
219216verts [0 ::5 , 0 ] = left
220217verts [0 ::5 , 1 ] = bottom
221218verts [1 ::5 , 0 ] = left
225222verts [3 ::5 , 0 ] = right
226223verts [3 ::5 , 1 ] = bottom
227224
228- barpath = path . Path (verts , codes )
225+ barpath = Path (verts , codes )
229226patch = patches .PathPatch (barpath , facecolor = 'green' ,
230227 edgecolor = 'yellow' , alpha = 0.5 )
231228ax .add_patch (patch )
You can’t perform that action at this time.
0 commit comments