1313import matplotlib
1414
1515import matplotlib .cbook as cbook
16- from matplotlib .cbook import _string_to_bool , mplDeprecation
16+ from matplotlib .cbook import mplDeprecation , STEP_LOOKUP_MAP
1717import matplotlib .collections as mcoll
1818import matplotlib .colors as mcolors
1919import matplotlib .contour as mcontour
@@ -4428,13 +4428,11 @@ def fill(self, *args, **kwargs):
44284428
44294429 @docstring .dedent_interpd
44304430 def fill_between (self , x , y1 , y2 = 0 , where = None , interpolate = False ,
4431+ step_where = None ,
44314432 ** kwargs ):
44324433 """
44334434 Make filled polygons between two curves.
44344435
4435- Call signature::
4436-
4437- fill_between(x, y1, y2=0, where=None, **kwargs)
44384436
44394437 Create a :class:`~matplotlib.collections.PolyCollection`
44404438 filling the regions between *y1* and *y2* where
@@ -4462,9 +4460,12 @@ def fill_between(self, x, y1, y2=0, where=None, interpolate=False,
44624460 end points of the filled region will only occur on explicit
44634461 values in the *x* array.
44644462
4463+ step_where : {'pre', 'post', 'mid'}, optional
4464+ If not None, fill with step logic.
4465+
44654466
4466- Note
4467- ----
4467+ Notes
4468+ -----
44684469
44694470 Additional Keyword args passed on to the
44704471 :class:`~matplotlib.collections.PolyCollection`.
@@ -4516,6 +4517,9 @@ def fill_between(self, x, y1, y2=0, where=None, interpolate=False,
45164517 xslice = x [ind0 :ind1 ]
45174518 y1slice = y1 [ind0 :ind1 ]
45184519 y2slice = y2 [ind0 :ind1 ]
4520+ if step_where is not None :
4521+ step_func = STEP_LOOKUP_MAP [step_where ]
4522+ xslice , y1slice , y2slice = step_func (xslice , y1slice , y2slice )
45194523
45204524 if not len (xslice ):
45214525 continue
@@ -4576,7 +4580,8 @@ def get_interp_point(ind):
45764580 return collection
45774581
45784582 @docstring .dedent_interpd
4579- def fill_betweenx (self , y , x1 , x2 = 0 , where = None , ** kwargs ):
4583+ def fill_betweenx (self , y , x1 , x2 = 0 , where = None ,
4584+ step_where = None , ** kwargs ):
45804585 """
45814586 Make filled polygons between two horizontal curves.
45824587
@@ -4588,19 +4593,27 @@ def fill_betweenx(self, y, x1, x2=0, where=None, **kwargs):
45884593 filling the regions between *x1* and *x2* where
45894594 ``where==True``
45904595
4591- *y* :
4596+ Parameters
4597+ ----------
4598+ y : array
45924599 An N-length array of the y data
45934600
4594- *x1* :
4601+ x1 : array
45954602 An N-length array (or scalar) of the x data
45964603
4597- *x2* :
4604+ x2 : array, optional
45984605 An N-length array (or scalar) of the x data
45994606
4600- *where* :
4601- If *None*, default to fill between everywhere. If not *None*,
4602- it is a N length numpy boolean array and the fill will
4603- only happen over the regions where ``where==True``
4607+ where : array, optional
4608+ If *None*, default to fill between everywhere. If not *None*,
4609+ it is a N length numpy boolean array and the fill will
4610+ only happen over the regions where ``where==True``
4611+
4612+ step_where : {'pre', 'post', 'mid'}, optional
4613+ If not None, fill with step logic.
4614+
4615+ Notes
4616+ -----
46044617
46054618 *kwargs* :
46064619 keyword args passed on to the
@@ -4610,9 +4623,13 @@ def fill_betweenx(self, y, x1, x2=0, where=None, **kwargs):
46104623
46114624 %(PolyCollection)s
46124625
4626+ Examples
4627+ --------
4628+
46134629 .. plot:: mpl_examples/pylab_examples/fill_betweenx_demo.py
46144630
4615- .. seealso::
4631+ See Also
4632+ --------
46164633
46174634 :meth:`fill_between`
46184635 for filling between two sets of y-values
@@ -4649,6 +4666,9 @@ def fill_betweenx(self, y, x1, x2=0, where=None, **kwargs):
46494666 yslice = y [ind0 :ind1 ]
46504667 x1slice = x1 [ind0 :ind1 ]
46514668 x2slice = x2 [ind0 :ind1 ]
4669+ if step_where is not None :
4670+ step_func = STEP_LOOKUP_MAP [step_where ]
4671+ yslice , x1slice , x2slice = step_func (yslice , x1slice , x2slice )
46524672
46534673 if not len (yslice ):
46544674 continue
0 commit comments