@@ -1739,14 +1739,42 @@ def _initialize_x_y(self, z):
1739
1739
are not given explicitly via *levels*.
1740
1740
Defaults to `~.ticker.MaxNLocator`.
1741
1741
1742
- extend : {'neither', 'both', 'min', 'max'}, optional
1743
- Unless this is 'neither', contour levels are automatically
1744
- added to one or both ends of the range so that all data
1745
- are included. These added ranges are then mapped to the
1746
- special colormap values which default to the ends of the
1747
- colormap range, but can be set via
1748
- :meth:`matplotlib.colors.Colormap.set_under` and
1749
- :meth:`matplotlib.colors.Colormap.set_over` methods.
1742
+ extend : {'neither', 'both', 'min', 'max'}, optional, default: \
1743
+ 'neither'
1744
+ Determines the ``contourf``-coloring of values that are outside the
1745
+ *levels* range.
1746
+
1747
+ If 'neither', values outside the *levels* range are not colored.
1748
+ If 'min', 'max' or 'both', color the values below, above or below
1749
+ and above the *levels* range.
1750
+
1751
+ Values below ``min(levels)`` and above ``max(levels)`` are mapped
1752
+ to the under/over values of the `.Colormap`. Note, that most
1753
+ colormaps do not have dedicated colors for these by default, so
1754
+ that the over and under values are the edge values of the colormap.
1755
+ You may want to set these values explicitly using
1756
+ `.Colormap.set_under` and `.Colormap.set_over`.
1757
+
1758
+ .. note::
1759
+
1760
+ An exising `.QuadContourSet` does not get notified if
1761
+ properties of its colormap are changed. Therefore, an explicit
1762
+ call `.QuadContourSet.changed()` is needed after modifying the
1763
+ colormap. The explicit call can be left out, if a colorbar is
1764
+ assigned to the `.QuadContourSet` because it interally calls
1765
+ `.QuadContourSet.changed()`.
1766
+
1767
+ Example::
1768
+
1769
+ x = np.arange(1, 10)
1770
+ y = x.reshape(-1, 1)
1771
+ h = x * y
1772
+
1773
+ cs = plt.contourf(h, levels=[10, 30, 50],
1774
+ colors=['#808080', '#A0A0A0', '#C0C0C0'], extend='both')
1775
+ cs.cmap.set_over('red')
1776
+ cs.cmap.set_under('blue')
1777
+ cs.changed()
1750
1778
1751
1779
xunits, yunits : registered units, optional
1752
1780
Override axis units by specifying an instance of a
0 commit comments