@@ -606,10 +606,13 @@ def _update_dividers(self):
606
606
self .dividers .set_segments (segments )
607
607
608
608
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 :]
610
613
patches = []
611
614
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 ]],
613
616
[X [i , 1 ], Y [i , 0 ]],
614
617
[X [i + 1 , 1 ], Y [i + 1 , 0 ]],
615
618
[X [i + 1 , 0 ], Y [i + 1 , 1 ]]])
@@ -661,9 +664,9 @@ def _do_extends(self, ax=None):
661
664
mappable = getattr (self , 'mappable' , None )
662
665
if (isinstance (mappable , contour .ContourSet )
663
666
and any (hatch is not None for hatch in mappable .hatches )):
664
- hatches = mappable .hatches
667
+ hatches = mappable .hatches * ( len ( self . _y ) + 1 )
665
668
else :
666
- hatches = [None ]
669
+ hatches = [None ] * ( len ( self . _y ) + 1 )
667
670
668
671
if self ._extend_lower ():
669
672
if not self .extendrect :
@@ -687,6 +690,8 @@ def _do_extends(self, ax=None):
687
690
zorder = np .nextafter (self .ax .patch .zorder , - np .inf ))
688
691
self .ax .add_patch (patch )
689
692
self ._extend_patches .append (patch )
693
+ # remove first hatch that goes into the extend patch
694
+ hatches = hatches [1 :]
690
695
if self ._extend_upper ():
691
696
if not self .extendrect :
692
697
# triangle
@@ -699,10 +704,12 @@ def _do_extends(self, ax=None):
699
704
# add the patch
700
705
val = 0 if self ._long_axis ().get_inverted () else - 1
701
706
color = self .cmap (self .norm (self ._values [val ]))
707
+ hatch_idx = len (self ._y ) - 1
702
708
patch = mpatches .PathPatch (
703
709
mpath .Path (xy ), facecolor = color , alpha = self .alpha ,
704
710
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 ,
706
713
# Place it right behind the standard patches, which is
707
714
# needed if we updated the extends
708
715
zorder = np .nextafter (self .ax .patch .zorder , - np .inf ))
0 commit comments