File tree 1 file changed +6
-9
lines changed
galleries/users_explain/artists 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 18
18
could use this code:
19
19
"""
20
20
21
+ import numpy as np
22
+
21
23
import matplotlib .pyplot as plt
22
24
23
25
import matplotlib .patches as patches
191
193
# edgecolor='yellow', alpha=0.5)
192
194
# ax.add_patch(patch)
193
195
194
- import numpy as np
195
-
196
- import matplotlib .patches as patches
197
- import matplotlib .path as path
198
-
199
196
fig , ax = plt .subplots ()
200
197
# Fixing random state for reproducibility
201
198
np .random .seed (19680801 )
213
210
214
211
nverts = nrects * (1 + 3 + 1 )
215
212
verts = 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
219
216
verts [0 ::5 , 0 ] = left
220
217
verts [0 ::5 , 1 ] = bottom
221
218
verts [1 ::5 , 0 ] = left
225
222
verts [3 ::5 , 0 ] = right
226
223
verts [3 ::5 , 1 ] = bottom
227
224
228
- barpath = path . Path (verts , codes )
225
+ barpath = Path (verts , codes )
229
226
patch = patches .PathPatch (barpath , facecolor = 'green' ,
230
227
edgecolor = 'yellow' , alpha = 0.5 )
231
228
ax .add_patch (patch )
You can’t perform that action at this time.
0 commit comments