@@ -229,11 +229,6 @@ def get_path(hatchpattern, density=6):
229
229
"scale" : 6 ,
230
230
"weight" : 1.0 ,
231
231
"angle" : 0.0 ,
232
- "random_rotation" : False ,
233
- "random_placement" : False ,
234
- "x_stagger" : 0.5 ,
235
- "y_stagger" : 0.0 ,
236
- "filled" : True ,
237
232
}
238
233
239
234
@@ -273,94 +268,14 @@ def get_vertices_and_codes(self, hatch_buffer_scale=1.0):
273
268
vertices , codes = np .empty ((0 , 2 )), np .empty (0 , Path .code_type )
274
269
275
270
if self .hatchpattern in hatchpatterns :
276
- # This is for line hatches
277
271
for func in np .atleast_1d (hatchpatterns [self .hatchpattern ]):
278
272
vertices_part , codes_part = func (self )
279
273
vertices_part = self ._rotate_vertices (vertices_part )
280
274
281
275
vertices = np .concatenate ((vertices , vertices_part ))
282
276
codes = np .concatenate ((codes , codes_part ))
283
277
else :
284
- # This is for marker hatches
285
- if self .hatchpattern not in MarkerHatchStyle .marker_paths :
286
- raise ValueError (f"Unknown hatch pattern: { self .hatchpattern } " )
287
- func = MarkerHatchStyle .marker_pattern
288
- vertices_part , codes_part = func (self )
289
-
290
- vertices = np .concatenate ((vertices , vertices_part ))
291
- codes = np .concatenate ((codes , codes_part ))
292
-
293
- return vertices , codes
294
-
295
-
296
- class MarkerHatchStyle (HatchStyle ):
297
- marker_paths = {
298
- "o" : Path .unit_circle ,
299
- "O" : Path .unit_circle ,
300
- "*" : (Path .unit_regular_star , 5 ), # TODO: is there a better way to do this?
301
- }
302
-
303
- # TODO: saner defaults or no?
304
- marker_sizes = {
305
- "o" : 0.2 ,
306
- "O" : 0.35 ,
307
- "*" : 1.0 / 3.0 ,
308
- }
309
-
310
- def _get_marker_path (marker ):
311
- func = np .atleast_1d (MarkerHatchStyle .marker_paths [marker ])
312
- path = func [0 ](* func [1 :])
313
- size = MarkerHatchStyle .marker_sizes .get (marker , attrs ["weight" ])
314
-
315
- return Path (
316
- vertices = path .vertices * size ,
317
- codes = path .codes ,
318
- )
319
-
320
- def marker_pattern (hatchstyle ):
321
- size = hatchstyle .kwargs ["weight" ]
322
- num_rows = round (hatchstyle .kwargs ["scale" ] * hatchstyle .hatch_buffer_scale )
323
- path = MarkerHatchStyle ._get_marker_path (hatchstyle .hatchpattern )
324
- marker_vertices = hatchstyle ._rotate_vertices (
325
- path .vertices , scale_correction = False
326
- )
327
- marker_codes = path .codes
328
-
329
- offset = 1.0 / num_rows
330
- marker_vertices = marker_vertices * offset * size
331
- x_stagger = hatchstyle .kwargs ["x_stagger" ] * offset
332
- y_stagger = hatchstyle .kwargs ["y_stagger" ] * offset
333
-
334
- if not hatchstyle .kwargs ["filled" ]:
335
- marker_vertices = np .concatenate (
336
- [marker_vertices , marker_vertices [::- 1 ] * 0.9 ]
337
- )
338
- marker_codes = np .concatenate ([marker_codes , marker_codes ])
339
-
340
- vertices = np .empty ((0 , 2 ))
341
- codes = np .empty (0 , Path .code_type )
342
- for row in range (num_rows + 1 ):
343
- row_pos = row * offset
344
- if row % 2 == 0 :
345
- cols = np .linspace (0 , 1 , num_rows + 1 )
346
- else :
347
- cols = np .linspace (x_stagger , 1 + x_stagger , num_rows + 1 )
348
-
349
- for i , col_pos in enumerate (cols ):
350
- vertices_part = marker_vertices + [col_pos , row_pos ]
351
- if i % 2 == 1 :
352
- vertices_part += [0 , y_stagger ]
353
-
354
- if hatchstyle .kwargs ["random_rotation" ]:
355
- vertices_part = hatchstyle ._rotate_vertices (
356
- vertices_part , np .random .uniform (0 , 360 ), scale_correction = False
357
- )
358
-
359
- if hatchstyle .kwargs ["random_placement" ]:
360
- vertices_part += np .random .uniform (- offset / 4 , offset / 4 , 2 )
361
-
362
- vertices = np .concatenate ((vertices , vertices_part ))
363
- codes = np .concatenate ((codes , marker_codes ))
278
+ _api .warn_external (f"Unknown hatch pattern: { self .hatchpattern } " )
364
279
365
280
return vertices , codes
366
281
0 commit comments