@@ -1775,14 +1775,42 @@ def _initialize_x_y(self, z):
1775
1775
are not given explicitly via *levels*.
1776
1776
Defaults to `~.ticker.MaxNLocator`.
1777
1777
1778
- extend : {'neither', 'both', 'min', 'max'}, optional
1779
- Unless this is 'neither', contour levels are automatically
1780
- added to one or both ends of the range so that all data
1781
- are included. These added ranges are then mapped to the
1782
- special colormap values which default to the ends of the
1783
- colormap range, but can be set via
1784
- :meth:`matplotlib.colors.Colormap.set_under` and
1785
- :meth:`matplotlib.colors.Colormap.set_over` methods.
1778
+ extend : {'neither', 'both', 'min', 'max'}, optional, default: \
1779
+ 'neither'
1780
+ Determines the ``contourf``-coloring of values that are outside the
1781
+ *levels* range.
1782
+
1783
+ If 'neither', values outside the *levels* range are not colored.
1784
+ If 'min', 'max' or 'both', color the values below, above or below
1785
+ and above the *levels* range.
1786
+
1787
+ Values below ``min(levels)`` and above ``max(levels)`` are mapped
1788
+ to the under/over values of the `.Colormap`. Note, that most
1789
+ colormaps do not have dedicated colors for these by default, so
1790
+ that the over and under values are the edge values of the colormap.
1791
+ You may want to set these values explicitly using
1792
+ `.Colormap.set_under` and `.Colormap.set_over`.
1793
+
1794
+ .. note::
1795
+
1796
+ An exising `.QuadContourSet` does not get notified if
1797
+ properties of its colormap are changed. Therefore, an explicit
1798
+ call `.QuadContourSet.changed()` is needed after modifying the
1799
+ colormap. The explicit call can be left out, if a colorbar is
1800
+ assigned to the `.QuadContourSet` because it interally calls
1801
+ `.QuadContourSet.changed()`.
1802
+
1803
+ Example::
1804
+
1805
+ x = np.arange(1, 10)
1806
+ y = x.reshape(-1, 1)
1807
+ h = x * y
1808
+
1809
+ cs = plt.contourf(h, levels=[10, 30, 50],
1810
+ colors=['#808080', '#A0A0A0', '#C0C0C0'], extend='both')
1811
+ cs.cmap.set_over('red')
1812
+ cs.cmap.set_under('blue')
1813
+ cs.changed()
1786
1814
1787
1815
xunits, yunits : registered units, optional
1788
1816
Override axis units by specifying an instance of a
0 commit comments