@@ -388,11 +388,10 @@ def draw(self, renderer):
388388 trans = self .get_transforms ()
389389 facecolors = self .get_facecolor ()
390390 edgecolors = self .get_edgecolor ()
391- linewidths = np .nan_to_num (self ._linewidths , nan = 0 , posinf = 0 ).clip (0 )
392391 do_single_path_optimization = False
393392 if (len (paths ) == 1 and len (trans ) <= 1 and
394393 len (facecolors ) == 1 and len (edgecolors ) == 1 and
395- len (linewidths ) == 1 and
394+ len (self . _linewidths ) == 1 and
396395 all (ls [1 ] is None for ls in self ._linestyles ) and
397396 len (self ._antialiaseds ) == 1 and len (self ._urls ) == 1 and
398397 self .get_hatch () is None ):
@@ -413,7 +412,7 @@ def draw(self, renderer):
413412
414413 if do_single_path_optimization :
415414 gc .set_foreground (tuple (edgecolors [0 ]))
416- gc .set_linewidth (linewidths [0 ])
415+ gc .set_linewidth (self . _linewidths [0 ])
417416 gc .set_dashes (* self ._linestyles [0 ])
418417 gc .set_antialiased (self ._antialiaseds [0 ])
419418 gc .set_url (self ._urls [0 ])
@@ -434,7 +433,7 @@ def draw(self, renderer):
434433 gc , transform .frozen (), [],
435434 self .get_transforms (), offsets , offset_trf ,
436435 self .get_facecolor (), self .get_edgecolor (),
437- linewidths , self ._linestyles ,
436+ self . _linewidths , self ._linestyles ,
438437 self ._antialiaseds , self ._urls ,
439438 "screen" , hatchcolors = self .get_hatchcolor ()
440439 )
@@ -454,7 +453,7 @@ def draw(self, renderer):
454453 # First draw paths within the gaps.
455454 ipaths , ilinestyles = self ._get_inverse_paths_linestyles ()
456455 args = [offsets , offset_trf , [mcolors .to_rgba ("none" )], self ._gapcolor ,
457- linewidths , ilinestyles , self ._antialiaseds , self ._urls ,
456+ self . _linewidths , ilinestyles , self ._antialiaseds , self ._urls ,
458457 "screen" ]
459458
460459 if hatchcolors_arg_supported :
@@ -479,7 +478,7 @@ def draw(self, renderer):
479478 renderer .draw_path (gc0 , path , transform , rgbFace )
480479
481480 args = [offsets , offset_trf , self .get_facecolor (), self .get_edgecolor (),
482- linewidths , self ._linestyles , self ._antialiaseds , self ._urls ,
481+ self . _linewidths , self ._linestyles , self ._antialiaseds , self ._urls ,
483482 "screen" ]
484483
485484 if hatchcolors_arg_supported :
@@ -665,6 +664,7 @@ def set_linewidth(self, lw):
665664 # scale all of the dash patterns.
666665 self ._linewidths , self ._linestyles = self ._bcast_lwls (
667666 self ._us_lw , self ._us_linestyles )
667+ self ._linewidths = np .nan_to_num (self ._linewidths , nan = 0 , posinf = 0 ).clip (0 )
668668 self .stale = True
669669
670670 def set_linestyle (self , ls ):
0 commit comments