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