matplotlib

Travis-CI:

This Page

matplotlib.axes.Axes.fill

Axes.fill(*args, **kwargs)

Plot filled polygons.

Call signature:

fill(*args, **kwargs)

args is a variable length argument, allowing for multiple x, y pairs with an optional color format string; see plot() for details on the argument parsing. For example, to plot a polygon with vertices at x, y in blue.:

ax.fill(x,y, 'b' )

An arbitrary number of x, y, color groups can be specified:

ax.fill(x1, y1, 'g', x2, y2, 'r')

Return value is a list of Patch instances that were added.

The same color strings that plot() supports are supported by the fill format string.

If you would like to fill below a curve, e.g., shade a region between 0 and y along x, use fill_between()

The closed kwarg will close the polygon when True (default).

kwargs control the Polygon properties:

Property Description
agg_filter unknown
alpha float or None
animated [True | False]
antialiased or aa [True | False] or None for default
axes an Axes instance
bottom_margin unknown
capstyle [‘butt’ | ‘round’ | ‘projecting’]
clip_box a matplotlib.transforms.Bbox instance
clip_on [True | False]
clip_path [ (Path, Transform) | Patch | None ]
color matplotlib color spec
contains a callable function
edgecolor or ec mpl color spec, None, ‘none’, or ‘auto’
facecolor or fc mpl color spec, or None for default, or ‘none’ for no color
figure a matplotlib.figure.Figure instance
fill [True | False]
gid an id string
hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle [‘miter’ | ‘round’ | ‘bevel’]
label string or anything printable with ‘%s’ conversion.
left_margin unknown
linestyle or ls [‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lw float or None for default
margins unknown
path_effects unknown
picker [None|float|boolean|callable]
rasterized [True | False | None]
right_margin unknown
sketch_params unknown
snap unknown
top_margin unknown
transform Transform instance
url a url string
visible [True | False]
zorder any number

Example:

(Source code, png, pdf)

../../_images/fill_demo.png

Notes

In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments are replaced by data[<arg>]:

  • All arguments with the following names: ‘x’, ‘y’.