@@ -606,10 +606,13 @@ def _update_dividers(self):
606606 self .dividers .set_segments (segments )
607607
608608 def _add_solids_patches (self , X , Y , C , mappable ):
609- hatches = mappable .hatches * len (C ) # Have enough hatches.
609+ hatches = mappable .hatches * (len (C ) + 1 ) # Have enough hatches.
610+ if self ._extend_lower ():
611+ # remove first hatch that goes into the extend patch
612+ hatches = hatches [1 :]
610613 patches = []
611614 for i in range (len (X ) - 1 ):
612- xy = np .array ([[X [i , 0 ], Y [i , 0 ]],
615+ xy = np .array ([[X [i , 0 ], Y [i , 1 ]],
613616 [X [i , 1 ], Y [i , 0 ]],
614617 [X [i + 1 , 1 ], Y [i + 1 , 0 ]],
615618 [X [i + 1 , 0 ], Y [i + 1 , 1 ]]])
@@ -661,9 +664,9 @@ def _do_extends(self, ax=None):
661664 mappable = getattr (self , 'mappable' , None )
662665 if (isinstance (mappable , contour .ContourSet )
663666 and any (hatch is not None for hatch in mappable .hatches )):
664- hatches = mappable .hatches
667+ hatches = mappable .hatches * ( len ( self . _y ) + 1 )
665668 else :
666- hatches = [None ]
669+ hatches = [None ] * ( len ( self . _y ) + 1 )
667670
668671 if self ._extend_lower ():
669672 if not self .extendrect :
@@ -687,6 +690,8 @@ def _do_extends(self, ax=None):
687690 zorder = np .nextafter (self .ax .patch .zorder , - np .inf ))
688691 self .ax .add_patch (patch )
689692 self ._extend_patches .append (patch )
693+ # remove first hatch that goes into the extend patch
694+ hatches = hatches [1 :]
690695 if self ._extend_upper ():
691696 if not self .extendrect :
692697 # triangle
@@ -699,10 +704,12 @@ def _do_extends(self, ax=None):
699704 # add the patch
700705 val = 0 if self ._long_axis ().get_inverted () else - 1
701706 color = self .cmap (self .norm (self ._values [val ]))
707+ hatch_idx = len (self ._y ) - 1
702708 patch = mpatches .PathPatch (
703709 mpath .Path (xy ), facecolor = color , alpha = self .alpha ,
704710 linewidth = 0 , antialiased = False ,
705- transform = self .ax .transAxes , hatch = hatches [- 1 ], clip_on = False ,
711+ transform = self .ax .transAxes , hatch = hatches [hatch_idx ],
712+ clip_on = False ,
706713 # Place it right behind the standard patches, which is
707714 # needed if we updated the extends
708715 zorder = np .nextafter (self .ax .patch .zorder , - np .inf ))
0 commit comments