@@ -4764,64 +4764,86 @@ def fill(self, *args, **kwargs):
4764
4764
label_namer = None )
4765
4765
@docstring .dedent_interpd
4766
4766
def fill_between (self , x , y1 , y2 = 0 , where = None , interpolate = False ,
4767
- step = None ,
4768
- ** kwargs ):
4767
+ step = None , ** kwargs ):
4769
4768
"""
4770
- Make filled polygons between two curves.
4769
+ Fill the area between two horizontal curves.
4771
4770
4771
+ The curves are defined by the points (*x*, *y1*) and (*x*, *y2*). This
4772
+ creates one or multiple polygons describing the filled area.
4773
+
4774
+ You may exclude some horizontal sections from filling using *where*.
4775
+
4776
+ By default, the edges connect the given points directly. Use *step* if
4777
+ the filling should be a step function, i.e. constant in between *x*.
4772
4778
4773
- Create a :class:`~matplotlib.collections.PolyCollection`
4774
- filling the regions between *y1* and *y2* where
4775
- ``where==True``
4776
4779
4777
4780
Parameters
4778
4781
----------
4779
- x : array
4780
- An N-length array of the x data
4782
+ x : array (length N)
4783
+ The x coordinates of the nodes defining the curves.
4781
4784
4782
- y1 : array
4783
- An N-length array (or scalar) of the y data
4785
+ y1 : array (length N) or scalar
4786
+ The y coordinates of the nodes defining the first curve.
4784
4787
4785
- y2 : array
4786
- An N-length array (or scalar) of the y data
4788
+ y2 : array (length N) or scalar, optional, default: 0
4789
+ The y coordinates of the nodes defining the second curve.
4787
4790
4788
- where : array, optional
4789
- If `None`, default to fill between everywhere. If not `None`,
4790
- it is an N-length numpy boolean array and the fill will
4791
- only happen over the regions where ``where==True``.
4791
+ where : array of bool (length N), optional, default: None
4792
+ Define *where* to exclude some horizontal regions from being
4793
+ filled. The filled regions are defined by the coordinates
4794
+ ``x[where]``. More precisely, fill between ``x[i]`` and ``x[i+1]``
4795
+ if ``where[i] and where[i+1]``. Note that this definition implies
4796
+ that an isolated *True* value between two *False* values in
4797
+ *where* will not result in filling. Both sides of the *True*
4798
+ position remain unfilled due to the adjacent *False* values.
4792
4799
4793
4800
interpolate : bool, optional
4794
- If `True`, interpolate between the two lines to find the
4795
- precise point of intersection. Otherwise, the start and
4796
- end points of the filled region will only occur on explicit
4797
- values in the *x* array.
4801
+ This option is only relvant if *where* is used and the two curves
4802
+ are crossing each other.
4798
4803
4799
- step : {'pre', 'post', 'mid'}, optional
4800
- If not None, fill with step logic.
4804
+ Semantically, *where* is often used for *y1* > *y2* or similar.
4805
+ By default, the nodes of the polygon defining the filled region
4806
+ will only be placed at the positions in the *x* array. Such a
4807
+ polygon cannot describe the above semantics close to the
4808
+ intersection. The x-sections containing the intersecion are
4809
+ simply clipped.
4801
4810
4802
- Returns
4803
- -------
4804
- `PolyCollection`
4805
- Plotted polygon collection
4811
+ Setting *interpolate* to *True* will calculate the actual
4812
+ interscection point and extend the filled region up to this point.
4806
4813
4807
- Notes
4808
- -----
4814
+ step : {'pre', 'post', 'mid'}, optional
4815
+ Define *step* if the filling should be a step function,
4816
+ i.e. constant in between *x*. The value determines where the
4817
+ step will occur:
4809
4818
4810
- Additional Keyword args passed on to the
4811
- :class:`~matplotlib.collections.PolyCollection`.
4819
+ - 'pre': The y value is continued constantly to the left from
4820
+ every *x* position.
4821
+ - 'post': The y value is continued constantly to the right from
4822
+ every *x* position.
4823
+ - 'mid': Steps occur in the middle between the *x* positions.
4812
4824
4813
- kwargs control the :class:`~matplotlib.patches.Polygon` properties:
4825
+ Other Parameters
4826
+ ----------------
4827
+ **kwargs
4828
+ All other keyword arguments are passed on to `~.PolyCollection`.
4829
+ They control the `~.Polygon` properties:
4814
4830
4815
- %(PolyCollection)s
4831
+ %(PolyCollection)s
4832
+
4833
+ Returns
4834
+ -------
4835
+ `~.PolyCollection`
4836
+ A `~.PolyCollection` containing the plotted polygons.
4816
4837
4817
4838
See Also
4818
4839
--------
4840
+ fill_betweenx : Fill between two sets of x-values.
4819
4841
4820
- :meth:`fill_betweenx`
4821
- for filling between two sets of x-values
4842
+ Notes
4843
+ -----
4844
+ .. [notes section required to get data note injection right]
4822
4845
4823
4846
"""
4824
-
4825
4847
if not rcParams ['_internal.classic_mode' ]:
4826
4848
color_aliases = mcoll ._color_aliases
4827
4849
kwargs = cbook .normalize_kwargs (kwargs , color_aliases )
@@ -4926,62 +4948,84 @@ def get_interp_point(ind):
4926
4948
def fill_betweenx (self , y , x1 , x2 = 0 , where = None ,
4927
4949
step = None , interpolate = False , ** kwargs ):
4928
4950
"""
4929
- Make filled polygons between two horizontal curves.
4951
+ Fill the area between two vertical curves.
4952
+
4953
+ The curves are defined by the points (*x1*, *y*) and (*x2*, *y*). This
4954
+ creates one or multiple polygons describing the filled area.
4930
4955
4956
+ You may exclude some vertical sections from filling using *where*.
4957
+
4958
+ By default, the edges connect the given points directly. Use *step* if
4959
+ the filling should be a step function, i.e. constant in between *y*.
4931
4960
4932
- Create a :class:`~matplotlib.collections.PolyCollection`
4933
- filling the regions between *x1* and *x2* where
4934
- ``where==True``
4935
4961
4936
4962
Parameters
4937
4963
----------
4938
- y : array
4939
- An N-length array of the y data
4940
-
4941
- x1 : array
4942
- An N-length array (or scalar) of the x data
4964
+ y : array (length N)
4965
+ The y coordinates of the nodes defining the curves.
4943
4966
4944
- x2 : array, optional
4945
- An N-length array (or scalar) of the x data
4967
+ x1 : array (length N) or scalar
4968
+ The x coordinates of the nodes defining the first curve.
4946
4969
4947
- where : array, optional
4948
- If *None*, default to fill between everywhere. If not *None*,
4949
- it is a N length numpy boolean array and the fill will
4950
- only happen over the regions where ``where==True``
4970
+ x2 : array (length N) or scalar, optional, default: 0
4971
+ The x coordinates of the nodes defining the second curve.
4951
4972
4952
- step : {'pre', 'post', 'mid'}, optional
4953
- If not None, fill with step logic.
4973
+ where : array of bool (length N), optional, default: None
4974
+ Define *where* to exclude some vertical regions from being
4975
+ filled. The filled regions are defined by the coordinates
4976
+ ``y[where]``. More precisely, fill between ``y[i]`` and ``y[i+1]``
4977
+ if ``where[i] and where[i+1]``. Note that this definition implies
4978
+ that an isolated *True* value between two *False* values in
4979
+ *where* will not result in filling. Both sides of the *True*
4980
+ position remain unfilled due to the adjacent *False* values.
4954
4981
4955
4982
interpolate : bool, optional
4956
- If `True`, interpolate between the two lines to find the
4957
- precise point of intersection. Otherwise, the start and
4958
- end points of the filled region will only occur on explicit
4959
- values in the *x* array.
4983
+ This option is only relvant if *where* is used and the two curves
4984
+ are crossing each other.
4960
4985
4986
+ Semantically, *where* is often used for *x1* > *x2* or similar.
4987
+ By default, the nodes of the polygon defining the filled region
4988
+ will only be placed at the positions in the *y* array. Such a
4989
+ polygon cannot describe the above semantics close to the
4990
+ intersection. The y-sections containing the intersecion are
4991
+ simply clipped.
4961
4992
4962
- Returns
4963
- -------
4964
- `PolyCollection`
4965
- Plotted polygon collection
4993
+ Setting *interpolate* to *True* will calculate the actual
4994
+ interscection point and extend the filled region up to this point.
4966
4995
4967
- Notes
4968
- -----
4996
+ step : {'pre', 'post', 'mid'}, optional
4997
+ Define *step* if the filling should be a step function,
4998
+ i.e. constant in between *y*. The value determines where the
4999
+ step will occur:
5000
+
5001
+ - 'pre': The y value is continued constantly below every *y*
5002
+ position.
5003
+ - 'post': The y value is continued constantly above every *y*
5004
+ position.
5005
+ - 'mid': Steps occur in the middle between the *y* positions.
4969
5006
4970
- keyword args passed on to the
4971
- :class:`~matplotlib.collections.PolyCollection`
5007
+ Other Parameters
5008
+ ----------------
5009
+ **kwargs
5010
+ All other keyword arguments are passed on to `~.PolyCollection`.
5011
+ They control the `~.Polygon` properties:
4972
5012
4973
- kwargs control the :class:`~matplotlib.patches.Polygon` properties:
5013
+ %(PolyCollection)s
4974
5014
4975
- %(PolyCollection)s
5015
+ Returns
5016
+ -------
5017
+ `~.PolyCollection`
5018
+ A `~.PolyCollection` containing the plotted polygons.
4976
5019
4977
5020
See Also
4978
5021
--------
5022
+ fill_between : Fill between two sets of y-values.
4979
5023
4980
- :meth:`fill_between`
4981
- for filling between two sets of y-values
5024
+ Notes
5025
+ -----
5026
+ .. [notes section required to get data note injection right]
4982
5027
4983
5028
"""
4984
-
4985
5029
if not rcParams ['_internal.classic_mode' ]:
4986
5030
color_aliases = mcoll ._color_aliases
4987
5031
kwargs = cbook .normalize_kwargs (kwargs , color_aliases )
0 commit comments