@@ -171,7 +171,6 @@ def __init__(self, *,
171
171
# Flags set by _set_mappable_flags: are colors from mapping an array?
172
172
self ._face_is_mapped = None
173
173
self ._edge_is_mapped = None
174
- self ._match_original = False
175
174
self ._mapped_colors = None # calculated in update_scalarmappable
176
175
self ._hatch_color = mcolors .to_rgba (mpl .rcParams ['hatch.color' ])
177
176
self .set_facecolor (facecolors )
@@ -362,7 +361,6 @@ def draw(self, renderer):
362
361
gc .set_snap (self .get_snap ())
363
362
364
363
if self ._hatch :
365
- gc .set_hatch (self ._hatch )
366
364
gc .set_hatch_color (self ._hatch_color )
367
365
368
366
if self .get_sketch_params () is not None :
@@ -387,7 +385,7 @@ def draw(self, renderer):
387
385
len (self ._linewidths ) == 1 and
388
386
all (ls [1 ] is None for ls in self ._linestyles ) and
389
387
len (self ._antialiaseds ) == 1 and len (self ._urls ) == 1 and
390
- self .get_hatch () is None ):
388
+ len ( self .get_hatch ()) == 0 ):
391
389
if len (trans ):
392
390
combined_transform = transforms .Affine2D (trans [0 ]) + transform
393
391
else :
@@ -421,34 +419,16 @@ def draw(self, renderer):
421
419
self .get_transforms (), offsets , offset_trf ,
422
420
[mcolors .to_rgba ("none" )], self ._gapcolor ,
423
421
self ._linewidths , ilinestyles ,
424
- self ._antialiaseds , self ._urls ,
422
+ self ._antialiaseds , self .get_hatch (), self . _urls ,
425
423
"screen" )
426
424
427
- fcolor = itertools .cycle (facecolors ) if facecolors .any () \
428
- else itertools .repeat ([])
429
- ecolor = itertools .cycle (edgecolors ) if edgecolors .any () \
430
- else itertools .repeat ([])
431
- lwidth = itertools .cycle (self ._linewidths )
432
- lstyle = itertools .cycle (self ._linestyles )
433
- antialiased = itertools .cycle (self ._antialiaseds )
434
-
435
- if self ._match_original :
436
- for idx in range (len (paths )):
437
- gc .set_hatch (self ._hatch [idx ])
438
- renderer .draw_path_collection (
439
- gc , transform .frozen (), [paths [idx ]],
440
- self .get_transforms (), offsets , offset_trf ,
441
- [next (fcolor )], [next (ecolor )], [next (lwidth )], [next (lstyle )],
442
- [next (antialiased )], self ._urls ,
443
- "screen" ) # offset_position, kept for backcompat.
444
- else :
445
- renderer .draw_path_collection (
446
- gc , transform .frozen (), paths ,
447
- self .get_transforms (), offsets , offset_trf ,
448
- self .get_facecolor (), self .get_edgecolor (),
449
- self ._linewidths , self ._linestyles ,
450
- self ._antialiaseds , self ._urls ,
451
- "screen" )
425
+ renderer .draw_path_collection (
426
+ gc , transform .frozen (), paths ,
427
+ self .get_transforms (), offsets , offset_trf ,
428
+ self .get_facecolor (), self .get_edgecolor (),
429
+ self ._linewidths , self ._linestyles ,
430
+ self ._antialiaseds , self .get_hatch (), self ._urls ,
431
+ "screen" ) # offset_position, kept for backcompat.
452
432
453
433
gc .restore ()
454
434
renderer .close_group (self .__class__ .__name__ )
@@ -552,7 +532,10 @@ def set_hatch(self, hatch):
552
532
hatch : {'/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
553
533
"""
554
534
# Use validate_hatch(list) after deprecation.
555
- mhatch ._validate_hatch_pattern (hatch )
535
+ if isinstance (hatch , str ):
536
+ hatch = [hatch ]
537
+ for h in hatch :
538
+ mhatch ._validate_hatch_pattern (h )
556
539
self ._hatch = hatch
557
540
self .stale = True
558
541
@@ -1887,12 +1870,11 @@ def __init__(self, patches, *, match_original=False, **kwargs):
1887
1870
"""
1888
1871
1889
1872
if match_original :
1890
- self ._match_original = True
1891
- kwargs ['facecolors' ] = tuple ([p .get_facecolor () for p in patches ])
1892
- kwargs ['linewidths' ] = tuple ([p .get_linewidth () for p in patches ])
1893
- kwargs ['linestyles' ] = tuple ([p .get_linestyle () for p in patches ])
1894
- kwargs ['antialiaseds' ] = tuple ([p .get_antialiased () for p in patches ])
1895
- kwargs ['hatch' ] = tuple ([p .get_hatch () for p in patches ])
1873
+ kwargs ['facecolors' ] = [p .get_facecolor () for p in patches ]
1874
+ kwargs ['linewidths' ] = [p .get_linewidth () for p in patches ]
1875
+ kwargs ['linestyles' ] = [p .get_linestyle () for p in patches ]
1876
+ kwargs ['antialiaseds' ] = [p .get_antialiased () for p in patches ]
1877
+ kwargs ['hatch' ] = [p .get_hatch () for p in patches ]
1896
1878
1897
1879
# Edgecolors are handled separately because are defaulted to None
1898
1880
# and the Hatch colors depend on them.
0 commit comments