matplotlib.pyplot.fill_betweenx#
- matplotlib.pyplot.fill_betweenx(y, x1, x2=0, where=None, step=None, interpolate=False, *, data=None, **kwargs)[source]#
Fill the area between two vertical curves.
The curves are defined by the points (y, x1) and (y, x2). This creates one or multiple polygons describing the filled area.
You may exclude some vertical sections from filling using where.
By default, the edges connect the given points directly. Use step if the filling should be a step function, i.e. constant in between y.
- Parameters:
- yarray (length N)
The y coordinates of the nodes defining the curves.
- x1array (length N) or scalar
The x coordinates of the nodes defining the first curve.
- x2array (length N) or scalar, default: 0
The x coordinates of the nodes defining the second curve.
- wherearray of bool (length N), optional
Define where to exclude some vertical regions from being filled. The filled regions are defined by the coordinates
y[where]
. More precisely, fill betweeny[i]
andy[i+1]
ifwhere[i] and where[i+1]
. Note that this definition implies that an isolated True value between two False values in where will not result in filling. Both sides of the True position remain unfilled due to the adjacent False values.- interpolatebool, default: False
This option is only relevant if where is used and the two curves are crossing each other.
Semantically, where is often used for x1 > x2 or similar. By default, the nodes of the polygon defining the filled region will only be placed at the positions in the y array. Such a polygon cannot describe the above semantics close to the intersection. The y-sections containing the intersection are simply clipped.
Setting interpolate to True will calculate the actual intersection point and extend the filled region up to this point.
- step{'pre', 'post', 'mid'}, optional
Define step if the filling should be a step function, i.e. constant in between y. The value determines where the step will occur:
'pre': The x value is continued constantly to the left from every y position, i.e. the interval
(y[i-1], y[i]]
has the valuex[i]
.'post': The y value is continued constantly to the right from every y position, i.e. the interval
[y[i], y[i+1])
has the valuex[i]
.'mid': Steps occur half-way between the y positions.
- Returns:
FillBetweenPolyCollection
A
FillBetweenPolyCollection
containing the plotted polygons.
- Other Parameters:
- dataindexable object, optional
If given, the following parameters also accept a string
s
, which is interpreted asdata[s]
ifs
is a key indata
:y, x1, x2, where
- **kwargs
All other keyword arguments are passed on to
FillBetweenPolyCollection
. They control thePolygon
properties:Property
Description
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
array-like or scalar or None
bool
antialiased
oraa
orantialiaseds
bool or list of bools
array-like or None
CapStyle
or {'butt', 'projecting', 'round'}(vmin: float, vmax: float)
BboxBase
or Nonebool
Patch or (Path, Transform) or None
Colormap
or str or Nonecolor or list of RGBA tuples
array (length N)
edgecolor
orec
oredgecolors
facecolor
orfacecolors
orfc
str
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
unknown
bool
JoinStyle
or {'miter', 'round', 'bevel'}object
linestyle
ordashes
orlinestyles
orls
str or tuple or list thereof
linewidth
orlinewidths
orlw
float or list of floats
bool
Normalize
or str or None(N, 2) or (2,) array-like
list of
AbstractPathEffect
list of array-like
None or bool or float or callable
float
bool
sizes
numpy.ndarray
or None(scale: float, length: float, randomness: float)
bool or None
str
list of str or None
list of array-like
unknown
bool
float
See also
fill_between
Fill between two sets of y-values.
fill_betweenx
Fill between two sets of x-values.
Notes
Note
This is the pyplot wrapper for
axes.Axes.fill_betweenx
.