|
31 | 31 | import numpy.ma as ma
|
32 | 32 |
|
33 | 33 | import matplotlib as mpl
|
| 34 | +from matplotlib.artist import Artist |
34 | 35 | from matplotlib.collections import LineCollection
|
35 | 36 | from matplotlib.collections import PolyCollection
|
36 | 37 | from matplotlib.image import imread
|
@@ -3592,7 +3593,11 @@ def contour(self,x,y,data,*args,**kwargs):
|
3592 | 3593 | # set axes limits to fit map region.
|
3593 | 3594 | self.set_axes_limits(ax=ax)
|
3594 | 3595 | # clip to map limbs
|
3595 |
| - CS.collections,c = self._cliplimb(ax,CS.collections) |
| 3596 | + if isinstance(CS, Artist): |
| 3597 | + # Since MPL 3.8, `QuadContourSet` objects are `Artist` objects too. |
| 3598 | + CS, c = self._cliplimb(ax, CS) |
| 3599 | + else: |
| 3600 | + CS.collections, c = self._cliplimb(ax, CS.collections) |
3596 | 3601 | return CS
|
3597 | 3602 |
|
3598 | 3603 | @_transform
|
@@ -3688,7 +3693,11 @@ def contourf(self,x,y,data,*args,**kwargs):
|
3688 | 3693 | # set axes limits to fit map region.
|
3689 | 3694 | self.set_axes_limits(ax=ax)
|
3690 | 3695 | # clip to map limbs
|
3691 |
| - CS.collections,c = self._cliplimb(ax,CS.collections) |
| 3696 | + if isinstance(CS, Artist): |
| 3697 | + # Since MPL 3.8, `QuadContourSet` objects are `Artist` objects too. |
| 3698 | + CS, c = self._cliplimb(ax, CS) |
| 3699 | + else: |
| 3700 | + CS.collections, c = self._cliplimb(ax, CS.collections) |
3692 | 3701 | return CS
|
3693 | 3702 |
|
3694 | 3703 | @_transformuv
|
@@ -4733,12 +4742,18 @@ def nightshade(self,date,color="k",delta=0.25,alpha=0.5,ax=None,zorder=2):
|
4733 | 4742 | # contour the day-night grid, coloring the night area
|
4734 | 4743 | # with the specified color and transparency.
|
4735 | 4744 | CS = self.contourf(x,y,daynight,1,colors=[color],alpha=alpha,ax=ax)
|
4736 |
| - # set zorder on ContourSet collections show night shading |
4737 |
| - # is on top. |
4738 |
| - for c in CS.collections: |
4739 |
| - c.set_zorder(zorder) |
4740 |
| - # clip to map limbs |
4741 |
| - CS.collections,c = self._cliplimb(ax,CS.collections) |
| 4745 | + if isinstance(CS, Artist): |
| 4746 | + # Since MPL 3.8, `QuadContourSet` objects are `Artist` objects too. |
| 4747 | + CS.set_zorder(zorder) |
| 4748 | + # clip to map limbs |
| 4749 | + CS, c = self._cliplimb(ax, CS) |
| 4750 | + else: |
| 4751 | + # set zorder on ContourSet collections show night shading |
| 4752 | + # is on top. |
| 4753 | + for c in CS.collections: |
| 4754 | + c.set_zorder(zorder) |
| 4755 | + # clip to map limbs |
| 4756 | + CS.collections, c = self._cliplimb(ax, CS.collections) |
4742 | 4757 | return CS
|
4743 | 4758 |
|
4744 | 4759 | def _check_ax(self):
|
|
0 commit comments