@@ -607,17 +607,19 @@ def _update_dividers(self):
607
607
self .dividers .set_segments (segments )
608
608
609
609
def _add_solids_patches (self , X , Y , C , mappable ):
610
- hatches = mappable .hatches * len (C ) # Have enough hatches.
610
+ hatches = mappable .hatches * ( len (C ) + 1 ) # Have enough hatches.
611
611
patches = []
612
+ hatch_offset = 1 if self ._extend_lower () else 0
612
613
for i in range (len (X ) - 1 ):
613
- xy = np .array ([[X [i , 0 ], Y [i , 0 ]],
614
+ xy = np .array ([[X [i , 0 ], Y [i , 1 ]],
614
615
[X [i , 1 ], Y [i , 0 ]],
615
616
[X [i + 1 , 1 ], Y [i + 1 , 0 ]],
616
617
[X [i + 1 , 0 ], Y [i + 1 , 1 ]]])
617
618
patch = mpatches .PathPatch (mpath .Path (xy ),
618
619
facecolor = self .cmap (self .norm (C [i ][0 ])),
619
- hatch = hatches [i ], linewidth = 0 ,
620
- antialiased = False , alpha = self .alpha )
620
+ hatch = hatches [i + hatch_offset ],
621
+ linewidth = 0 , antialiased = False ,
622
+ alpha = self .alpha )
621
623
self .ax .add_patch (patch )
622
624
patches .append (patch )
623
625
self .solids_patches = patches
@@ -662,10 +664,11 @@ def _do_extends(self, ax=None):
662
664
mappable = getattr (self , 'mappable' , None )
663
665
if (isinstance (mappable , contour .ContourSet )
664
666
and any (hatch is not None for hatch in mappable .hatches )):
665
- hatches = mappable .hatches
667
+ hatches = mappable .hatches * ( len ( self . _y ) + 1 )
666
668
else :
667
- hatches = [None ]
669
+ hatches = [None ] * ( len ( self . _y ) + 1 )
668
670
671
+ hatch_offset = 0
669
672
if self ._extend_lower ():
670
673
if not self .extendrect :
671
674
# triangle
@@ -688,6 +691,7 @@ def _do_extends(self, ax=None):
688
691
zorder = np .nextafter (self .ax .patch .zorder , - np .inf ))
689
692
self .ax .add_patch (patch )
690
693
self ._extend_patches .append (patch )
694
+ hatch_offset = 1
691
695
if self ._extend_upper ():
692
696
if not self .extendrect :
693
697
# triangle
@@ -700,10 +704,12 @@ def _do_extends(self, ax=None):
700
704
# add the patch
701
705
val = 0 if self ._long_axis ().get_inverted () else - 1
702
706
color = self .cmap (self .norm (self ._values [val ]))
707
+ hatch_idx = len (self ._y ) - 1 + hatch_offset
703
708
patch = mpatches .PathPatch (
704
709
mpath .Path (xy ), facecolor = color , alpha = self .alpha ,
705
710
linewidth = 0 , antialiased = False ,
706
- transform = self .ax .transAxes , hatch = hatches [- 1 ], clip_on = False ,
711
+ transform = self .ax .transAxes , hatch = hatches [hatch_idx ],
712
+ clip_on = False ,
707
713
# Place it right behind the standard patches, which is
708
714
# needed if we updated the extends
709
715
zorder = np .nextafter (self .ax .patch .zorder , - np .inf ))
0 commit comments