@@ -423,7 +423,10 @@ def draw(self, renderer):
423423 # The current new API of draw_path_collection() is provisional
424424 # and will be changed in a future PR.
425425
426- # Find whether renderer.draw_path_collection() takes hatchcolor parameter
426+ # Find whether renderer.draw_path_collection() takes hatchcolor parameter.
427+ # Since third-party implementations of draw_path_collection() may not be
428+ # introspectable, e.g. with inspect.signature, the only way is to try and
429+ # call this with the hatchcolors parameter.
427430 hatchcolors_arg_supported = True
428431 try :
429432 renderer .draw_path_collection (
@@ -435,6 +438,9 @@ def draw(self, renderer):
435438 "screen" , hatchcolors = self .get_hatchcolor ()
436439 )
437440 except TypeError :
441+ # If the renderer does not support the hatchcolors argument,
442+ # it will raise a TypeError. In this case, we will
443+ # iterate over all paths and draw them one by one.
438444 hatchcolors_arg_supported = False
439445
440446 if self ._gapcolor is not None :
@@ -449,8 +455,6 @@ def draw(self, renderer):
449455 self .get_transforms (), * args ,
450456 hatchcolors = self .get_hatchcolor ())
451457 else :
452- # If the renderer does not support the hatchcolors argument,
453- # iterate over the paths and draw them one by one.
454458 path_ids = renderer ._iter_collection_raw_paths (
455459 transform .frozen (), ipaths , self .get_transforms ())
456460 for xo , yo , path_id , gc0 , rgbFace in renderer ._iter_collection (
0 commit comments