doc_content
stringlengths 1
386k
| doc_id
stringlengths 5
188
|
---|---|
classThetaLocator(base)[source]
Bases: matplotlib.ticker.Locator Used to locate theta ticks. This will work the same as the base locator except in the case that the view spans the entire circle. In such cases, the previously used default locations of every 45 degrees are returned. refresh()[source]
set_axis(axis)[source]
view_limits(vmin, vmax)[source]
Select a scale for the range from vmin to vmax. Subclasses should override this method to change locator behaviour.
|
matplotlib.projections_api#matplotlib.projections.polar.PolarAxes.ThetaLocator
|
refresh()[source]
|
matplotlib.projections_api#matplotlib.projections.polar.PolarAxes.ThetaLocator.refresh
|
set_axis(axis)[source]
|
matplotlib.projections_api#matplotlib.projections.polar.PolarAxes.ThetaLocator.set_axis
|
view_limits(vmin, vmax)[source]
Select a scale for the range from vmin to vmax. Subclasses should override this method to change locator behaviour.
|
matplotlib.projections_api#matplotlib.projections.polar.PolarAxes.ThetaLocator.view_limits
|
classmatplotlib.projections.polar.PolarTransform(axis=None, use_rmin=True, _apply_theta_transforms=True)[source]
Bases: matplotlib.transforms.Transform The base polar transform. This handles projection theta and r into Cartesian coordinate space x and y, but does not perform the ultimate affine transformation into the correct position. Parameters
shorthand_namestr
A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True. has_inverse=True
True if this transform has a corresponding inverse transform.
input_dims=2
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
inverted()[source]
Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.
output_dims=2
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
transform_non_affine(tr)[source]
Apply only the non-affine part of this transformation. transform(values) is always equivalent to transform_affine(transform_non_affine(values)). In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op. Parameters
valuesarray
The input values as NumPy array of length input_dims or shape (N x input_dims). Returns
array
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.
transform_path_non_affine(path)[source]
Apply the non-affine part of this transform to Path path, returning a new Path. transform_path(path) is equivalent to transform_path_affine(transform_path_non_affine(values)).
|
matplotlib.projections_api#matplotlib.projections.polar.PolarTransform
|
has_inverse=True
True if this transform has a corresponding inverse transform.
|
matplotlib.projections_api#matplotlib.projections.polar.PolarTransform.has_inverse
|
input_dims=2
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
|
matplotlib.projections_api#matplotlib.projections.polar.PolarTransform.input_dims
|
inverted()[source]
Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.
|
matplotlib.projections_api#matplotlib.projections.polar.PolarTransform.inverted
|
output_dims=2
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
|
matplotlib.projections_api#matplotlib.projections.polar.PolarTransform.output_dims
|
transform_non_affine(tr)[source]
Apply only the non-affine part of this transformation. transform(values) is always equivalent to transform_affine(transform_non_affine(values)). In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op. Parameters
valuesarray
The input values as NumPy array of length input_dims or shape (N x input_dims). Returns
array
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.
|
matplotlib.projections_api#matplotlib.projections.polar.PolarTransform.transform_non_affine
|
transform_path_non_affine(path)[source]
Apply the non-affine part of this transform to Path path, returning a new Path. transform_path(path) is equivalent to transform_path_affine(transform_path_non_affine(values)).
|
matplotlib.projections_api#matplotlib.projections.polar.PolarTransform.transform_path_non_affine
|
classmatplotlib.projections.polar.RadialAxis(*args, **kwargs)[source]
Bases: matplotlib.axis.YAxis A radial Axis. This overrides certain properties of a YAxis to provide special-casing for a radial axis. Parameters
axesmatplotlib.axes.Axes
The Axes to which the created Axis belongs.
pickradiusfloat
The acceptance radius for containment tests. See also Axis.contains. axis_name='radius'
Read-only name identifying the axis.
cla()[source]
[Deprecated] Notes Deprecated since version 3.4:
clear()[source]
Clear the axis. This resets axis properties to their default values: the label the scale locators, formatters and ticks major and minor grid units registered callbacks
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, data_interval=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, inverted=<UNSET>, label=<UNSET>, label_coords=<UNSET>, label_position=<UNSET>, label_text=<UNSET>, major_formatter=<UNSET>, major_locator=<UNSET>, minor_formatter=<UNSET>, minor_locator=<UNSET>, offset_position=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, remove_overlapping_locs=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, tick_params=<UNSET>, ticklabels=<UNSET>, ticks=<UNSET>, ticks_position=<UNSET>, transform=<UNSET>, units=<UNSET>, url=<UNSET>, view_interval=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
data_interval unknown
figure Figure
gid str
in_layout bool
inverted unknown
label object
label_coords unknown
label_position {'left', 'right'}
label_text str
major_formatter Formatter, str, or function
major_locator Locator
minor_formatter Formatter, str, or function
minor_locator Locator
offset_position {'left', 'right'}
path_effects AbstractPathEffect
picker None or bool or float or callable
pickradius float
rasterized bool
remove_overlapping_locs unknown
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
tick_params unknown
ticklabels sequence of str or of Texts
ticks list of floats
ticks_position {'left', 'right', 'both', 'default', 'none'}
transform Transform
units units tag
url str
view_interval unknown
visible bool
zorder float
|
matplotlib.projections_api#matplotlib.projections.polar.RadialAxis
|
axis_name='radius'
Read-only name identifying the axis.
|
matplotlib.projections_api#matplotlib.projections.polar.RadialAxis.axis_name
|
cla()[source]
[Deprecated] Notes Deprecated since version 3.4:
|
matplotlib.projections_api#matplotlib.projections.polar.RadialAxis.cla
|
clear()[source]
Clear the axis. This resets axis properties to their default values: the label the scale locators, formatters and ticks major and minor grid units registered callbacks
|
matplotlib.projections_api#matplotlib.projections.polar.RadialAxis.clear
|
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, data_interval=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, inverted=<UNSET>, label=<UNSET>, label_coords=<UNSET>, label_position=<UNSET>, label_text=<UNSET>, major_formatter=<UNSET>, major_locator=<UNSET>, minor_formatter=<UNSET>, minor_locator=<UNSET>, offset_position=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, remove_overlapping_locs=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, tick_params=<UNSET>, ticklabels=<UNSET>, ticks=<UNSET>, ticks_position=<UNSET>, transform=<UNSET>, units=<UNSET>, url=<UNSET>, view_interval=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
data_interval unknown
figure Figure
gid str
in_layout bool
inverted unknown
label object
label_coords unknown
label_position {'left', 'right'}
label_text str
major_formatter Formatter, str, or function
major_locator Locator
minor_formatter Formatter, str, or function
minor_locator Locator
offset_position {'left', 'right'}
path_effects AbstractPathEffect
picker None or bool or float or callable
pickradius float
rasterized bool
remove_overlapping_locs unknown
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
tick_params unknown
ticklabels sequence of str or of Texts
ticks list of floats
ticks_position {'left', 'right', 'both', 'default', 'none'}
transform Transform
units units tag
url str
view_interval unknown
visible bool
zorder float
|
matplotlib.projections_api#matplotlib.projections.polar.RadialAxis.set
|
classmatplotlib.projections.polar.RadialLocator(base, axes=None)[source]
Bases: matplotlib.ticker.Locator Used to locate radius ticks. Ensures that all ticks are strictly positive. For all other tasks, it delegates to the base Locator (which may be different depending on the scale of the r-axis). nonsingular(vmin, vmax)[source]
Adjust a range as needed to avoid singularities. This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not. If v0 == v1 (possibly up to some floating point slop), this method returns an expanded interval around this value. If (v0, v1) == (-inf, +inf), this method returns appropriate default view limits. Otherwise, (v0, v1) is returned without modification.
set_axis(axis)[source]
view_limits(vmin, vmax)[source]
Select a scale for the range from vmin to vmax. Subclasses should override this method to change locator behaviour.
|
matplotlib.projections_api#matplotlib.projections.polar.RadialLocator
|
nonsingular(vmin, vmax)[source]
Adjust a range as needed to avoid singularities. This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not. If v0 == v1 (possibly up to some floating point slop), this method returns an expanded interval around this value. If (v0, v1) == (-inf, +inf), this method returns appropriate default view limits. Otherwise, (v0, v1) is returned without modification.
|
matplotlib.projections_api#matplotlib.projections.polar.RadialLocator.nonsingular
|
set_axis(axis)[source]
|
matplotlib.projections_api#matplotlib.projections.polar.RadialLocator.set_axis
|
view_limits(vmin, vmax)[source]
Select a scale for the range from vmin to vmax. Subclasses should override this method to change locator behaviour.
|
matplotlib.projections_api#matplotlib.projections.polar.RadialLocator.view_limits
|
classmatplotlib.projections.polar.RadialTick(*args, **kwargs)[source]
Bases: matplotlib.axis.YTick A radial-axis tick. This subclass of YTick provides radial ticks with some small modification to their re-positioning such that ticks are rotated based on axes limits. This results in ticks that are correctly perpendicular to the spine. Labels are also rotated to be perpendicular to the spine, when 'auto' rotation is enabled. bbox is the Bound2D bounding box in display coords of the Axes loc is the tick location in data coords size is the tick size in points set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, label1=<UNSET>, label2=<UNSET>, pad=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
figure Figure
gid str
in_layout bool
label str
label1 str
label2 str
pad float
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
update_position(loc)[source]
Set the location of tick in data coords with scalar loc.
|
matplotlib.projections_api#matplotlib.projections.polar.RadialTick
|
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, label1=<UNSET>, label2=<UNSET>, pad=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
figure Figure
gid str
in_layout bool
label str
label1 str
label2 str
pad float
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
|
matplotlib.projections_api#matplotlib.projections.polar.RadialTick.set
|
update_position(loc)[source]
Set the location of tick in data coords with scalar loc.
|
matplotlib.projections_api#matplotlib.projections.polar.RadialTick.update_position
|
classmatplotlib.projections.polar.ThetaAxis(*args, **kwargs)[source]
Bases: matplotlib.axis.XAxis A theta Axis. This overrides certain properties of an XAxis to provide special-casing for an angular axis. Parameters
axesmatplotlib.axes.Axes
The Axes to which the created Axis belongs.
pickradiusfloat
The acceptance radius for containment tests. See also Axis.contains. axis_name='theta'
Read-only name identifying the axis.
cla()[source]
[Deprecated] Notes Deprecated since version 3.4:
clear()[source]
Clear the axis. This resets axis properties to their default values: the label the scale locators, formatters and ticks major and minor grid units registered callbacks
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, data_interval=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, inverted=<UNSET>, label=<UNSET>, label_coords=<UNSET>, label_position=<UNSET>, label_text=<UNSET>, major_formatter=<UNSET>, major_locator=<UNSET>, minor_formatter=<UNSET>, minor_locator=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, remove_overlapping_locs=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, tick_params=<UNSET>, ticklabels=<UNSET>, ticks=<UNSET>, ticks_position=<UNSET>, transform=<UNSET>, units=<UNSET>, url=<UNSET>, view_interval=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
data_interval unknown
figure Figure
gid str
in_layout bool
inverted unknown
label object
label_coords unknown
label_position {'top', 'bottom'}
label_text str
major_formatter Formatter, str, or function
major_locator Locator
minor_formatter Formatter, str, or function
minor_locator Locator
path_effects AbstractPathEffect
picker None or bool or float or callable
pickradius float
rasterized bool
remove_overlapping_locs unknown
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
tick_params unknown
ticklabels sequence of str or of Texts
ticks list of floats
ticks_position {'top', 'bottom', 'both', 'default', 'none'}
transform Transform
units units tag
url str
view_interval unknown
visible bool
zorder float
|
matplotlib.projections_api#matplotlib.projections.polar.ThetaAxis
|
axis_name='theta'
Read-only name identifying the axis.
|
matplotlib.projections_api#matplotlib.projections.polar.ThetaAxis.axis_name
|
cla()[source]
[Deprecated] Notes Deprecated since version 3.4:
|
matplotlib.projections_api#matplotlib.projections.polar.ThetaAxis.cla
|
clear()[source]
Clear the axis. This resets axis properties to their default values: the label the scale locators, formatters and ticks major and minor grid units registered callbacks
|
matplotlib.projections_api#matplotlib.projections.polar.ThetaAxis.clear
|
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, data_interval=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, inverted=<UNSET>, label=<UNSET>, label_coords=<UNSET>, label_position=<UNSET>, label_text=<UNSET>, major_formatter=<UNSET>, major_locator=<UNSET>, minor_formatter=<UNSET>, minor_locator=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, remove_overlapping_locs=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, tick_params=<UNSET>, ticklabels=<UNSET>, ticks=<UNSET>, ticks_position=<UNSET>, transform=<UNSET>, units=<UNSET>, url=<UNSET>, view_interval=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
data_interval unknown
figure Figure
gid str
in_layout bool
inverted unknown
label object
label_coords unknown
label_position {'top', 'bottom'}
label_text str
major_formatter Formatter, str, or function
major_locator Locator
minor_formatter Formatter, str, or function
minor_locator Locator
path_effects AbstractPathEffect
picker None or bool or float or callable
pickradius float
rasterized bool
remove_overlapping_locs unknown
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
tick_params unknown
ticklabels sequence of str or of Texts
ticks list of floats
ticks_position {'top', 'bottom', 'both', 'default', 'none'}
transform Transform
units units tag
url str
view_interval unknown
visible bool
zorder float
|
matplotlib.projections_api#matplotlib.projections.polar.ThetaAxis.set
|
classmatplotlib.projections.polar.ThetaFormatter[source]
Bases: matplotlib.ticker.Formatter Used to format the theta tick labels. Converts the native unit of radians into degrees and adds a degree symbol.
|
matplotlib.projections_api#matplotlib.projections.polar.ThetaFormatter
|
classmatplotlib.projections.polar.ThetaLocator(base)[source]
Bases: matplotlib.ticker.Locator Used to locate theta ticks. This will work the same as the base locator except in the case that the view spans the entire circle. In such cases, the previously used default locations of every 45 degrees are returned. refresh()[source]
set_axis(axis)[source]
view_limits(vmin, vmax)[source]
Select a scale for the range from vmin to vmax. Subclasses should override this method to change locator behaviour.
|
matplotlib.projections_api#matplotlib.projections.polar.ThetaLocator
|
refresh()[source]
|
matplotlib.projections_api#matplotlib.projections.polar.ThetaLocator.refresh
|
set_axis(axis)[source]
|
matplotlib.projections_api#matplotlib.projections.polar.ThetaLocator.set_axis
|
view_limits(vmin, vmax)[source]
Select a scale for the range from vmin to vmax. Subclasses should override this method to change locator behaviour.
|
matplotlib.projections_api#matplotlib.projections.polar.ThetaLocator.view_limits
|
classmatplotlib.projections.polar.ThetaTick(axes, *args, **kwargs)[source]
Bases: matplotlib.axis.XTick A theta-axis tick. This subclass of XTick provides angular ticks with some small modification to their re-positioning such that ticks are rotated based on tick location. This results in ticks that are correctly perpendicular to the arc spine. When 'auto' rotation is enabled, labels are also rotated to be parallel to the spine. The label padding is also applied here since it's not possible to use a generic axes transform to produce tick-specific padding. bbox is the Bound2D bounding box in display coords of the Axes loc is the tick location in data coords size is the tick size in points set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, label1=<UNSET>, label2=<UNSET>, pad=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
figure Figure
gid str
in_layout bool
label str
label1 str
label2 str
pad float
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
update_position(loc)[source]
Set the location of tick in data coords with scalar loc.
|
matplotlib.projections_api#matplotlib.projections.polar.ThetaTick
|
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, label1=<UNSET>, label2=<UNSET>, pad=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
figure Figure
gid str
in_layout bool
label str
label1 str
label2 str
pad float
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
|
matplotlib.projections_api#matplotlib.projections.polar.ThetaTick.set
|
update_position(loc)[source]
Set the location of tick in data coords with scalar loc.
|
matplotlib.projections_api#matplotlib.projections.polar.ThetaTick.update_position
|
classmatplotlib.projections.ProjectionRegistry[source]
Bases: object A mapping of registered projection names to projection classes. get_projection_class(name)[source]
Get a projection class from its name.
get_projection_names()[source]
Return the names of all projections currently registered.
register(*projections)[source]
Register a new set of projections.
|
matplotlib.projections_api#matplotlib.projections.ProjectionRegistry
|
get_projection_class(name)[source]
Get a projection class from its name.
|
matplotlib.projections_api#matplotlib.projections.ProjectionRegistry.get_projection_class
|
get_projection_names()[source]
Return the names of all projections currently registered.
|
matplotlib.projections_api#matplotlib.projections.ProjectionRegistry.get_projection_names
|
register(*projections)[source]
Register a new set of projections.
|
matplotlib.projections_api#matplotlib.projections.ProjectionRegistry.register
|
matplotlib.projections.register_projection(cls)[source]
|
matplotlib.projections_api#matplotlib.projections.register_projection
|
matplotlib.pyplot matplotlib.pyplot is a state-based interface to matplotlib. It provides an implicit, MATLAB-like, way of plotting. It also opens figures on your screen, and acts as the figure GUI manager. pyplot is mainly intended for interactive plots and simple cases of programmatic plot generation: import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 5, 0.1)
y = np.sin(x)
plt.plot(x, y)
The explicit (object-oriented) API is recommended for complex plots, though pyplot is still usually used to create the figure and often the axes in the figure. See pyplot.figure, pyplot.subplots, and pyplot.subplot_mosaic to create figures, and Axes API for the plotting methods on an axes: import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 5, 0.1)
y = np.sin(x)
fig, ax = plt.subplots()
ax.plot(x, y)
Functions
acorr(x, *[, data]) Plot the autocorrelation of x.
angle_spectrum(x[, Fs, Fc, window, pad_to, ...]) Plot the angle spectrum.
annotate(text, xy, *args, **kwargs) Annotate the point xy with text text.
arrow(x, y, dx, dy, **kwargs) Add an arrow to the Axes.
autoscale([enable, axis, tight]) Autoscale the axis view to the data (toggle).
autumn() Set the colormap to 'autumn'.
axes([arg]) Add an axes to the current figure and make it the current axes.
axhline([y, xmin, xmax]) Add a horizontal line across the axis.
axhspan(ymin, ymax[, xmin, xmax]) Add a horizontal span (rectangle) across the Axes.
axis(*args[, emit]) Convenience method to get or set some axis properties.
axline(xy1[, xy2, slope]) Add an infinitely long straight line.
axvline([x, ymin, ymax]) Add a vertical line across the Axes.
axvspan(xmin, xmax[, ymin, ymax]) Add a vertical span (rectangle) across the Axes.
bar(x, height[, width, bottom, align, data]) Make a bar plot.
bar_label(container[, labels, fmt, ...]) Label a bar plot.
barbs(*args[, data]) Plot a 2D field of barbs.
barh(y, width[, height, left, align]) Make a horizontal bar plot.
bone() Set the colormap to 'bone'.
box([on]) Turn the axes box on or off on the current axes.
boxplot(x[, notch, sym, vert, whis, ...]) Draw a box and whisker plot.
broken_barh(xranges, yrange, *[, data]) Plot a horizontal sequence of rectangles.
cla() Clear the current axes.
clabel(CS[, levels]) Label a contour plot.
clf() Clear the current figure.
clim([vmin, vmax]) Set the color limits of the current image.
close([fig]) Close a figure window.
cohere(x, y[, NFFT, Fs, Fc, detrend, ...]) Plot the coherence between x and y.
colorbar([mappable, cax, ax]) Add a colorbar to a plot.
connect(s, func) Bind function func to event s.
contour(*args[, data]) Plot contour lines.
contourf(*args[, data]) Plot filled contours.
cool() Set the colormap to 'cool'.
copper() Set the colormap to 'copper'.
csd(x, y[, NFFT, Fs, Fc, detrend, window, ...]) Plot the cross-spectral density.
delaxes([ax]) Remove an Axes (defaulting to the current axes) from its figure.
disconnect(cid) Disconnect the callback with id cid.
draw() Redraw the current figure.
draw_if_interactive() Redraw the current figure if in interactive mode.
errorbar(x, y[, yerr, xerr, fmt, ecolor, ...]) Plot y versus x as lines and/or markers with attached errorbars.
eventplot(positions[, orientation, ...]) Plot identical parallel lines at the given positions.
figimage(X[, xo, yo, alpha, norm, cmap, ...]) Add a non-resampled image to the figure.
figlegend(*args, **kwargs) Place a legend on the figure.
fignum_exists(num) Return whether the figure with the given id exists.
figtext(x, y, s[, fontdict]) Add text to figure.
figure([num, figsize, dpi, facecolor, ...]) Create a new figure, or activate an existing figure.
fill(*args[, data]) Plot filled polygons.
fill_between(x, y1[, y2, where, ...]) Fill the area between two horizontal curves.
fill_betweenx(y, x1[, x2, where, step, ...]) Fill the area between two vertical curves.
findobj([o, match, include_self]) Find artist objects.
flag() Set the colormap to 'flag'.
gca(**kwargs) Get the current Axes.
gcf() Get the current figure.
gci() Get the current colorable artist.
get(obj, *args, **kwargs) Return the value of an Artist's property, or print all of them.
get_current_fig_manager() Return the figure manager of the current figure.
get_figlabels() Return a list of existing figure labels.
get_fignums() Return a list of existing figure numbers.
get_plot_commands() Get a sorted list of all of the plotting commands.
getp(obj, *args, **kwargs) Return the value of an Artist's property, or print all of them.
ginput([n, timeout, show_clicks, mouse_add, ...]) Blocking call to interact with a figure.
gray() Set the colormap to 'gray'.
grid([visible, which, axis]) Configure the grid lines.
hexbin(x, y[, C, gridsize, bins, xscale, ...]) Make a 2D hexagonal binning plot of points x, y.
hist(x[, bins, range, density, weights, ...]) Plot a histogram.
hist2d(x, y[, bins, range, density, ...]) Make a 2D histogram plot.
hlines(y, xmin, xmax[, colors, linestyles, ...]) Plot horizontal lines at each y from xmin to xmax.
hot() Set the colormap to 'hot'.
hsv() Set the colormap to 'hsv'.
imread(fname[, format]) Read an image from a file into an array.
imsave(fname, arr, **kwargs) Save an array as an image file.
imshow(X[, cmap, norm, aspect, ...]) Display data as an image, i.e., on a 2D regular raster.
inferno() Set the colormap to 'inferno'.
install_repl_displayhook() Install a repl display hook so that any stale figure are automatically redrawn when control is returned to the repl.
ioff() Disable interactive mode.
ion() Enable interactive mode.
isinteractive() Return whether plots are updated after every plotting command.
jet() Set the colormap to 'jet'.
legend(*args, **kwargs) Place a legend on the Axes.
locator_params([axis, tight]) Control behavior of major tick locators.
loglog(*args, **kwargs) Make a plot with log scaling on both the x and y axis.
magma() Set the colormap to 'magma'.
magnitude_spectrum(x[, Fs, Fc, window, ...]) Plot the magnitude spectrum.
margins(*margins[, x, y, tight]) Set or retrieve autoscaling margins.
matshow(A[, fignum]) Display an array as a matrix in a new figure window.
minorticks_off() Remove minor ticks from the Axes.
minorticks_on() Display minor ticks on the Axes.
new_figure_manager(num, *args, **kwargs) Create a new figure manager instance.
nipy_spectral() Set the colormap to 'nipy_spectral'.
pause(interval) Run the GUI event loop for interval seconds.
pcolor(*args[, shading, alpha, norm, cmap, ...]) Create a pseudocolor plot with a non-regular rectangular grid.
pcolormesh(*args[, alpha, norm, cmap, vmin, ...]) Create a pseudocolor plot with a non-regular rectangular grid.
phase_spectrum(x[, Fs, Fc, window, pad_to, ...]) Plot the phase spectrum.
pie(x[, explode, labels, colors, autopct, ...]) Plot a pie chart.
pink() Set the colormap to 'pink'.
plasma() Set the colormap to 'plasma'.
plot(*args[, scalex, scaley, data]) Plot y versus x as lines and/or markers.
plot_date(x, y[, fmt, tz, xdate, ydate, data]) Plot coercing the axis to treat floats as dates.
polar(*args, **kwargs) Make a polar plot.
prism() Set the colormap to 'prism'.
psd(x[, NFFT, Fs, Fc, detrend, window, ...]) Plot the power spectral density.
quiver(*args[, data]) Plot a 2D field of arrows.
quiverkey(Q, X, Y, U, label, **kwargs) Add a key to a quiver plot.
rc(group, **kwargs) Set the current rcParams. group is the grouping for the rc, e.g., for lines.linewidth the group is lines, for axes.facecolor, the group is axes, and so on. Group may also be a list or tuple of group names, e.g., (xtick, ytick). kwargs is a dictionary attribute name/value pairs, e.g.,::.
rc_context([rc, fname]) Return a context manager for temporarily changing rcParams.
rcdefaults() Restore the rcParams from Matplotlib's internal default style.
rgrids([radii, labels, angle, fmt]) Get or set the radial gridlines on the current polar plot.
savefig(*args, **kwargs) Save the current figure.
sca(ax) Set the current Axes to ax and the current Figure to the parent of ax.
scatter(x, y[, s, c, marker, cmap, norm, ...]) A scatter plot of y vs.
sci(im) Set the current image.
semilogx(*args, **kwargs) Make a plot with log scaling on the x axis.
semilogy(*args, **kwargs) Make a plot with log scaling on the y axis.
set_cmap(cmap) Set the default colormap, and applies it to the current image if any.
set_loglevel(*args, **kwargs) Set Matplotlib's root logger and root logger handler level, creating the handler if it does not exist yet.
setp(obj, *args, **kwargs) Set one or more properties on an Artist, or list allowed values.
show(*[, block]) Display all open figures.
specgram(x[, NFFT, Fs, Fc, detrend, window, ...]) Plot a spectrogram.
spring() Set the colormap to 'spring'.
spy(Z[, precision, marker, markersize, ...]) Plot the sparsity pattern of a 2D array.
stackplot(x, *args[, labels, colors, ...]) Draw a stacked area plot.
stairs(values[, edges, orientation, ...]) A stepwise constant function as a line with bounding edges or a filled plot.
stem(*args[, linefmt, markerfmt, basefmt, ...]) Create a stem plot.
step(x, y, *args[, where, data]) Make a step plot.
streamplot(x, y, u, v[, density, linewidth, ...]) Draw streamlines of a vector flow.
subplot(*args, **kwargs) Add an Axes to the current figure or retrieve an existing Axes.
subplot2grid(shape, loc[, rowspan, colspan, fig]) Create a subplot at a specific location inside a regular grid.
subplot_mosaic(mosaic, *[, sharex, sharey, ...]) Build a layout of Axes based on ASCII art or nested lists.
subplot_tool([targetfig]) Launch a subplot tool window for a figure.
subplots([nrows, ncols, sharex, sharey, ...]) Create a figure and a set of subplots.
subplots_adjust([left, bottom, right, top, ...]) Adjust the subplot layout parameters.
summer() Set the colormap to 'summer'.
suptitle(t, **kwargs) Add a centered suptitle to the figure.
switch_backend(newbackend) Close all open figures and set the Matplotlib backend.
table([cellText, cellColours, cellLoc, ...]) Add a table to an Axes.
text(x, y, s[, fontdict]) Add text to the Axes.
thetagrids([angles, labels, fmt]) Get or set the theta gridlines on the current polar plot.
tick_params([axis]) Change the appearance of ticks, tick labels, and gridlines.
ticklabel_format(*[, axis, style, ...]) Configure the ScalarFormatter used by default for linear axes.
tight_layout(*[, pad, h_pad, w_pad, rect]) Adjust the padding between and around subplots.
title(label[, fontdict, loc, pad, y]) Set a title for the Axes.
tricontour(*args, **kwargs) Draw contour lines on an unstructured triangular grid.
tricontourf(*args, **kwargs) Draw contour regions on an unstructured triangular grid.
tripcolor(*args[, alpha, norm, cmap, vmin, ...]) Create a pseudocolor plot of an unstructured triangular grid.
triplot(*args, **kwargs) Draw a unstructured triangular grid as lines and/or markers.
twinx([ax]) Make and return a second axes that shares the x-axis.
twiny([ax]) Make and return a second axes that shares the y-axis.
uninstall_repl_displayhook() Uninstall the Matplotlib display hook.
violinplot(dataset[, positions, vert, ...]) Make a violin plot.
viridis() Set the colormap to 'viridis'.
vlines(x, ymin, ymax[, colors, linestyles, ...]) Plot vertical lines at each x from ymin to ymax.
waitforbuttonpress([timeout]) Blocking call to interact with the figure.
winter() Set the colormap to 'winter'.
xcorr(x, y[, normed, detrend, usevlines, ...]) Plot the cross correlation between x and y.
xkcd([scale, length, randomness]) Turn on xkcd sketch-style drawing mode.
xlabel(xlabel[, fontdict, labelpad, loc]) Set the label for the x-axis.
xlim(*args, **kwargs) Get or set the x limits of the current axes.
xscale(value, **kwargs) Set the x-axis scale.
xticks([ticks, labels]) Get or set the current tick locations and labels of the x-axis.
ylabel(ylabel[, fontdict, labelpad, loc]) Set the label for the y-axis.
ylim(*args, **kwargs) Get or set the y-limits of the current axes.
yscale(value, **kwargs) Set the y-axis scale.
yticks([ticks, labels]) Get or set the current tick locations and labels of the y-axis.
|
matplotlib._as_gen.matplotlib.pyplot
|
matplotlib.pyplot Pyplot function overview
pyplot matplotlib.pyplot is a state-based interface to matplotlib. matplotlib.pyplot.plotting()[source]
Function Description
acorr Plot the autocorrelation of x.
angle_spectrum Plot the angle spectrum.
annotate Annotate the point xy with text text.
arrow Add an arrow to the Axes.
autoscale Autoscale the axis view to the data (toggle).
axes Add an axes to the current figure and make it the current axes.
axhline Add a horizontal line across the axis.
axhspan Add a horizontal span (rectangle) across the Axes.
axis Convenience method to get or set some axis properties.
axline Add an infinitely long straight line.
axvline Add a vertical line across the Axes.
axvspan Add a vertical span (rectangle) across the Axes.
bar Make a bar plot.
bar_label Label a bar plot.
barbs Plot a 2D field of barbs.
barh Make a horizontal bar plot.
box Turn the axes box on or off on the current axes.
boxplot Draw a box and whisker plot.
broken_barh Plot a horizontal sequence of rectangles.
cla Clear the current axes.
clabel Label a contour plot.
clf Clear the current figure.
clim Set the color limits of the current image.
close Close a figure window.
cohere Plot the coherence between x and y.
colorbar Add a colorbar to a plot.
contour Plot contour lines.
contourf Plot filled contours.
csd Plot the cross-spectral density.
delaxes Remove an Axes (defaulting to the current axes) from its figure.
draw Redraw the current figure.
draw_if_interactive Redraw the current figure if in interactive mode.
errorbar Plot y versus x as lines and/or markers with attached errorbars.
eventplot Plot identical parallel lines at the given positions.
figimage Add a non-resampled image to the figure.
figlegend Place a legend on the figure.
fignum_exists Return whether the figure with the given id exists.
figtext Add text to figure.
figure Create a new figure, or activate an existing figure.
fill Plot filled polygons.
fill_between Fill the area between two horizontal curves.
fill_betweenx Fill the area between two vertical curves.
findobj Find artist objects.
gca Get the current Axes.
gcf Get the current figure.
gci Get the current colorable artist.
get Return the value of an Artist's property, or print all of them.
get_figlabels Return a list of existing figure labels.
get_fignums Return a list of existing figure numbers.
getp Return the value of an Artist's property, or print all of them.
grid Configure the grid lines.
hexbin Make a 2D hexagonal binning plot of points x, y.
hist Plot a histogram.
hist2d Make a 2D histogram plot.
hlines Plot horizontal lines at each y from xmin to xmax.
imread Read an image from a file into an array.
imsave Save an array as an image file.
imshow Display data as an image, i.e., on a 2D regular raster.
install_repl_displayhook Install a repl display hook so that any stale figure are automatically redrawn when control is returned to the repl.
ioff Disable interactive mode.
ion Enable interactive mode.
isinteractive Return whether plots are updated after every plotting command.
legend Place a legend on the Axes.
locator_params Control behavior of major tick locators.
loglog Make a plot with log scaling on both the x and y axis.
magnitude_spectrum Plot the magnitude spectrum.
margins Set or retrieve autoscaling margins.
matshow Display an array as a matrix in a new figure window.
minorticks_off Remove minor ticks from the Axes.
minorticks_on Display minor ticks on the Axes.
new_figure_manager Create a new figure manager instance.
pause Run the GUI event loop for interval seconds.
pcolor Create a pseudocolor plot with a non-regular rectangular grid.
pcolormesh Create a pseudocolor plot with a non-regular rectangular grid.
phase_spectrum Plot the phase spectrum.
pie Plot a pie chart.
plot Plot y versus x as lines and/or markers.
plot_date Plot coercing the axis to treat floats as dates.
polar Make a polar plot.
psd Plot the power spectral density.
quiver Plot a 2D field of arrows.
quiverkey Add a key to a quiver plot.
rc Set the current rcParams.
rc_context Return a context manager for temporarily changing rcParams.
rcdefaults Restore the rcParams from Matplotlib's internal default style.
rgrids Get or set the radial gridlines on the current polar plot.
savefig Save the current figure.
sca Set the current Axes to ax and the current Figure to the parent of ax.
scatter A scatter plot of y vs.
sci Set the current image.
semilogx Make a plot with log scaling on the x axis.
semilogy Make a plot with log scaling on the y axis.
set_cmap Set the default colormap, and applies it to the current image if any.
set_loglevel Set Matplotlib's root logger and root logger handler level, creating the handler if it does not exist yet.
setp Set one or more properties on an Artist, or list allowed values.
show Display all open figures.
specgram Plot a spectrogram.
spy Plot the sparsity pattern of a 2D array.
stackplot Draw a stacked area plot.
stairs A stepwise constant function as a line with bounding edges or a filled plot.
stem Create a stem plot.
step Make a step plot.
streamplot Draw streamlines of a vector flow.
subplot Add an Axes to the current figure or retrieve an existing Axes.
subplot2grid Create a subplot at a specific location inside a regular grid.
subplot_mosaic Build a layout of Axes based on ASCII art or nested lists.
subplot_tool Launch a subplot tool window for a figure.
subplots Create a figure and a set of subplots.
subplots_adjust Adjust the subplot layout parameters.
suptitle Add a centered suptitle to the figure.
switch_backend Close all open figures and set the Matplotlib backend.
table Add a table to an Axes.
text Add text to the Axes.
thetagrids Get or set the theta gridlines on the current polar plot.
tick_params Change the appearance of ticks, tick labels, and gridlines.
ticklabel_format Configure the ScalarFormatter used by default for linear axes.
tight_layout Adjust the padding between and around subplots.
title Set a title for the Axes.
tricontour Draw contour lines on an unstructured triangular grid.
tricontourf Draw contour regions on an unstructured triangular grid.
tripcolor Create a pseudocolor plot of an unstructured triangular grid.
triplot Draw a unstructured triangular grid as lines and/or markers.
twinx Make and return a second axes that shares the x-axis.
twiny Make and return a second axes that shares the y-axis.
uninstall_repl_displayhook Uninstall the Matplotlib display hook.
violinplot Make a violin plot.
vlines Plot vertical lines at each x from ymin to ymax.
xcorr Plot the cross correlation between x and y.
xkcd Turn on xkcd sketch-style drawing mode.
xlabel Set the label for the x-axis.
xlim Get or set the x limits of the current axes.
xscale Set the x-axis scale.
xticks Get or set the current tick locations and labels of the x-axis.
ylabel Set the label for the y-axis.
ylim Get or set the y-limits of the current axes.
yscale Set the y-axis scale.
yticks Get or set the current tick locations and labels of the y-axis.
Colors in Matplotlib There are many colormaps you can use to map data onto color values. Below we list several ways in which color can be utilized in Matplotlib. For a more in-depth look at colormaps, see the Choosing Colormaps in Matplotlib tutorial. matplotlib.pyplot.colormaps[source]
Container for colormaps that are known to Matplotlib by name. Experimental While we expect the API to be final, we formally mark it as experimental for 3.5 because we want to keep the option to still adapt the API for 3.6 should the need arise. The universal registry instance is matplotlib.colormaps. There should be no need for users to instantiate ColormapRegistry themselves. Read access uses a dict-like interface mapping names to Colormaps: import matplotlib as mpl
cmap = mpl.colormaps['viridis']
Returned Colormaps are copies, so that their modification does not change the global definition of the colormap. Additional colormaps can be added via ColormapRegistry.register: mpl.colormaps.register(my_colormap)
|
matplotlib.pyplot_summary
|
matplotlib.pyplot.acorr matplotlib.pyplot.acorr(x, *, data=None, **kwargs)[source]
Plot the autocorrelation of x. Parameters
xarray-like
detrendcallable, default: mlab.detrend_none (no detrending)
A detrending function applied to x. It must have the signature detrend(x: np.ndarray) -> np.ndarray
normedbool, default: True
If True, input vectors are normalised to unit length.
usevlinesbool, default: True
Determines the plot style. If True, vertical lines are plotted from 0 to the acorr value using Axes.vlines. Additionally, a horizontal line is plotted at y=0 using Axes.axhline. If False, markers are plotted at the acorr values using Axes.plot.
maxlagsint, default: 10
Number of lags to show. If None, will return all 2 * len(x) - 1 lags. Returns
lagsarray (length 2*maxlags+1)
The lag vector.
carray (length 2*maxlags+1)
The auto correlation vector.
lineLineCollection or Line2D
Artist added to the Axes of the correlation:
LineCollection if usevlines is True.
Line2D if usevlines is False.
bLine2D or None
Horizontal line at 0 if usevlines is True None usevlines is False. Other Parameters
linestyleLine2D property, optional
The linestyle for plotting the data points. Only used if usevlines is False.
markerstr, default: 'o'
The marker for plotting the data points. Only used if usevlines is False.
dataindexable object, optional
If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception): x **kwargs
Additional parameters are passed to Axes.vlines and Axes.axhline if usevlines is True; otherwise they are passed to Axes.plot. Notes The cross correlation is performed with numpy.correlate with mode = "full".
|
matplotlib._as_gen.matplotlib.pyplot.acorr
|
matplotlib.pyplot.angle_spectrum matplotlib.pyplot.angle_spectrum(x, Fs=None, Fc=None, window=None, pad_to=None, sides=None, *, data=None, **kwargs)[source]
Plot the angle spectrum. Compute the angle spectrum (wrapped phase spectrum) of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal. Parameters
x1-D array or sequence
Array or sequence containing the data.
Fsfloat, default: 2
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
windowcallable or ndarray, default: window_hanning
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional
The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).
Fcint, default: 0
The center frequency of x, which offsets the x extents of the plot to reflect the frequency range used when a signal is acquired and then filtered and downsampled to baseband. Returns
spectrum1-D array
The values for the angle spectrum in radians (real valued).
freqs1-D array
The frequencies corresponding to the elements in spectrum.
lineLine2D
The line created by this function. Other Parameters
dataindexable object, optional
If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception): x **kwargs
Keyword arguments control the Line2D properties:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color or c color
dash_capstyle CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
dashes sequence of floats (on/off ink in points) or (None, None)
data (2, N) array or two 1D arrays
drawstyle or ds {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure Figure
fillstyle {'full', 'left', 'right', 'bottom', 'top', 'none'}
gid str
in_layout bool
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float
marker marker style string, Path or MarkerStyle
markeredgecolor or mec color
markeredgewidth or mew float
markerfacecolor or mfc color
markerfacecoloralt or mfcalt color
markersize or ms float
markevery None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects AbstractPathEffect
picker float or callable[[Artist, Event], tuple[bool, dict]]
pickradius float
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
solid_capstyle CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
transform unknown
url str
visible bool
xdata 1D array
ydata 1D array
zorder float See also magnitude_spectrum
Plots the magnitudes of the corresponding frequencies. phase_spectrum
Plots the unwrapped version of this function. specgram
Can plot the angle spectrum of segments within the signal in a colormap.
|
matplotlib._as_gen.matplotlib.pyplot.angle_spectrum
|
matplotlib.pyplot.annotate matplotlib.pyplot.annotate(text, xy, *args, **kwargs)[source]
Annotate the point xy with text text. In the simplest form, the text is placed at xy. Optionally, the text can be displayed in another position xytext. An arrow pointing from the text to the annotated point xy can then be added by defining arrowprops. Parameters
textstr
The text of the annotation.
xy(float, float)
The point (x, y) to annotate. The coordinate system is determined by xycoords.
xytext(float, float), default: xy
The position (x, y) to place the text at. The coordinate system is determined by textcoords.
xycoordsstr or Artist or Transform or callable or (float, float), default: 'data'
The coordinate system that xy is given in. The following types of values are supported:
One of the following strings:
Value Description
'figure points' Points from the lower left of the figure
'figure pixels' Pixels from the lower left of the figure
'figure fraction' Fraction of figure from lower left
'subfigure points' Points from the lower left of the subfigure
'subfigure pixels' Pixels from the lower left of the subfigure
'subfigure fraction' Fraction of subfigure from lower left
'axes points' Points from lower left corner of axes
'axes pixels' Pixels from lower left corner of axes
'axes fraction' Fraction of axes from lower left
'data' Use the coordinate system of the object being annotated (default)
'polar' (theta, r) if not native 'data' coordinates Note that 'subfigure pixels' and 'figure pixels' are the same for the parent figure, so users who want code that is usable in a subfigure can use 'subfigure pixels'. An Artist: xy is interpreted as a fraction of the artist's Bbox. E.g. (0, 0) would be the lower left corner of the bounding box and (0.5, 1) would be the center top of the bounding box. A Transform to transform xy to screen coordinates.
A function with one of the following signatures: def transform(renderer) -> Bbox
def transform(renderer) -> Transform
where renderer is a RendererBase subclass. The result of the function is interpreted like the Artist and Transform cases above. A tuple (xcoords, ycoords) specifying separate coordinate systems for x and y. xcoords and ycoords must each be of one of the above described types. See Advanced Annotations for more details.
textcoordsstr or Artist or Transform or callable or (float, float), default: value of xycoords
The coordinate system that xytext is given in. All xycoords values are valid as well as the following strings:
Value Description
'offset points' Offset (in points) from the xy value
'offset pixels' Offset (in pixels) from the xy value
arrowpropsdict, optional
The properties used to draw a FancyArrowPatch arrow between the positions xy and xytext. Defaults to None, i.e. no arrow is drawn. For historical reasons there are two different ways to specify arrows, "simple" and "fancy": Simple arrow: If arrowprops does not contain the key 'arrowstyle' the allowed keys are:
Key Description
width The width of the arrow in points
headwidth The width of the base of the arrow head in points
headlength The length of the arrow head in points
shrink Fraction of total length to shrink from both ends
? Any key to matplotlib.patches.FancyArrowPatch The arrow is attached to the edge of the text box, the exact position (corners or centers) depending on where it's pointing to. Fancy arrow: This is used if 'arrowstyle' is provided in the arrowprops. Valid keys are the following FancyArrowPatch parameters:
Key Description
arrowstyle the arrow style
connectionstyle the connection style
relpos see below; default is (0.5, 0.5)
patchA default is bounding box of the text
patchB default is None
shrinkA default is 2 points
shrinkB default is 2 points
mutation_scale default is text size (in points)
mutation_aspect default is 1.
? any key for matplotlib.patches.PathPatch The exact starting point position of the arrow is defined by relpos. It's a tuple of relative coordinates of the text box, where (0, 0) is the lower left corner and (1, 1) is the upper right corner. Values <0 and >1 are supported and specify points outside the text box. By default (0.5, 0.5) the starting point is centered in the text box.
annotation_clipbool or None, default: None
Whether to draw the annotation when the annotation point xy is outside the axes area. If True, the annotation will only be drawn when xy is within the axes. If False, the annotation will always be drawn. If None, the annotation will only be drawn when xy is within the axes and xycoords is 'data'. **kwargs
Additional kwargs are passed to Text. Returns
Annotation
See also Advanced Annotations
Examples using matplotlib.pyplot.annotate
Pyplot tutorial
Annotations
|
matplotlib._as_gen.matplotlib.pyplot.annotate
|
matplotlib.pyplot.arrow matplotlib.pyplot.arrow(x, y, dx, dy, **kwargs)[source]
Add an arrow to the Axes. This draws an arrow from (x, y) to (x+dx, y+dy). Parameters
x, yfloat
The x and y coordinates of the arrow base.
dx, dyfloat
The length of the arrow along x and y direction.
widthfloat, default: 0.001
Width of full arrow tail.
length_includes_headbool, default: False
True if head is to be counted in calculating the length.
head_widthfloat or None, default: 3*width
Total width of the full arrow head.
head_lengthfloat or None, default: 1.5*head_width
Length of arrow head.
shape{'full', 'left', 'right'}, default: 'full'
Draw the left-half, right-half, or full arrow.
overhangfloat, default: 0
Fraction that the arrow is swept back (0 overhang means triangular shape). Can be negative or greater than one.
head_starts_at_zerobool, default: False
If True, the head starts being drawn at coordinate 0 instead of ending at coordinate 0. **kwargs
Patch properties:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha unknown
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float Returns
FancyArrow
The created FancyArrow object. Notes The resulting arrow is affected by the Axes aspect ratio and limits. This may produce an arrow whose head is not square with its stem. To create an arrow whose head is square with its stem, use annotate() for example: >>> ax.annotate("", xy=(0.5, 0.5), xytext=(0, 0),
... arrowprops=dict(arrowstyle="->"))
|
matplotlib._as_gen.matplotlib.pyplot.arrow
|
matplotlib.pyplot.autoscale matplotlib.pyplot.autoscale(enable=True, axis='both', tight=None)[source]
Autoscale the axis view to the data (toggle). Convenience method for simple axis view autoscaling. It turns autoscaling on or off, and then, if autoscaling for either axis is on, it performs the autoscaling on the specified axis or Axes. Parameters
enablebool or None, default: True
True turns autoscaling on, False turns it off. None leaves the autoscaling state unchanged.
axis{'both', 'x', 'y'}, default: 'both'
Which axis to operate on.
tightbool or None, default: None
If True, first set the margins to zero. Then, this argument is forwarded to autoscale_view (regardless of its value); see the description of its behavior there.
|
matplotlib._as_gen.matplotlib.pyplot.autoscale
|
matplotlib.pyplot.autumn matplotlib.pyplot.autumn()[source]
Set the colormap to 'autumn'. This changes the default colormap as well as the colormap of the current image if there is one. See help(colormaps) for more information.
|
matplotlib._as_gen.matplotlib.pyplot.autumn
|
matplotlib.pyplot.axes matplotlib.pyplot.axes(arg=None, **kwargs)[source]
Add an axes to the current figure and make it the current axes. Call signatures: plt.axes()
plt.axes(rect, projection=None, polar=False, **kwargs)
plt.axes(ax)
Parameters
argNone or 4-tuple
The exact behavior of this function depends on the type:
None: A new full window axes is added using subplot(**kwargs). 4-tuple of floats rect = [left, bottom, width, height]. A new axes is added with dimensions rect in normalized (0, 1) units using add_axes on the current figure.
projection{None, 'aitoff', 'hammer', 'lambert', 'mollweide', 'polar', 'rectilinear', str}, optional
The projection type of the Axes. str is the name of a custom projection, see projections. The default None results in a 'rectilinear' projection.
polarbool, default: False
If True, equivalent to projection='polar'.
sharex, shareyAxes, optional
Share the x or y axis with sharex and/or sharey. The axis will have the same limits, ticks, and scale as the axis of the shared axes.
labelstr
A label for the returned axes. Returns
Axes, or a subclass of Axes
The returned axes class depends on the projection used. It is Axes if rectilinear projection is used and projections.polar.PolarAxes if polar projection is used. Other Parameters
**kwargs
This method also takes the keyword arguments for the returned axes class. The keyword arguments for the rectilinear axes class Axes can be found in the following table but there might also be other keyword arguments if another projection is used, see the actual axes class.
Property Description
adjustable {'box', 'datalim'}
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
anchor (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}
animated bool
aspect {'auto', 'equal'} or float
autoscale_on bool
autoscalex_on bool
autoscaley_on bool
axes_locator Callable[[Axes, Renderer], Bbox]
axisbelow bool or 'line'
box_aspect float or None
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
facecolor or fc color
figure Figure
frame_on bool
gid str
in_layout bool
label object
navigate bool
navigate_mode unknown
path_effects AbstractPathEffect
picker None or bool or float or callable
position [left, bottom, width, height] or Bbox
prop_cycle unknown
rasterization_zorder float or None
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
title str
transform Transform
url str
visible bool
xbound unknown
xlabel str
xlim (bottom: float, top: float)
xmargin float greater than -0.5
xscale {"linear", "log", "symlog", "logit", ...} or ScaleBase
xticklabels unknown
xticks unknown
ybound unknown
ylabel str
ylim (bottom: float, top: float)
ymargin float greater than -0.5
yscale {"linear", "log", "symlog", "logit", ...} or ScaleBase
yticklabels unknown
yticks unknown
zorder float See also Figure.add_axes
pyplot.subplot
Figure.add_subplot
Figure.subplots
pyplot.subplots
Notes If the figure already has a axes with key (args, kwargs) then it will simply make that axes current and return it. This behavior is deprecated. Meanwhile, if you do not want this behavior (i.e., you want to force the creation of a new axes), you must use a unique set of args and kwargs. The axes label attribute has been exposed for this purpose: if you want two axes that are otherwise identical to be added to the figure, make sure you give them unique labels. Examples # Creating a new full window axes
plt.axes()
# Creating a new axes with specified dimensions and some kwargs
plt.axes((left, bottom, width, height), facecolor='w')
Examples using matplotlib.pyplot.axes
Subplots spacings and margins
Make Room For Ylabel Using Axesgrid
Lasso Demo
Buttons
Check Buttons
Radio Buttons
Thresholding an Image with RangeSlider
Slider
Snapping Sliders to Discrete Values
|
matplotlib._as_gen.matplotlib.pyplot.axes
|
matplotlib.pyplot.axhline matplotlib.pyplot.axhline(y=0, xmin=0, xmax=1, **kwargs)[source]
Add a horizontal line across the axis. Parameters
yfloat, default: 0
y position in data coordinates of the horizontal line.
xminfloat, default: 0
Should be between 0 and 1, 0 being the far left of the plot, 1 the far right of the plot.
xmaxfloat, default: 1
Should be between 0 and 1, 0 being the far left of the plot, 1 the far right of the plot. Returns
Line2D
Other Parameters
**kwargs
Valid keyword arguments are Line2D properties, with the exception of 'transform':
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color or c color
dash_capstyle CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
dashes sequence of floats (on/off ink in points) or (None, None)
data (2, N) array or two 1D arrays
drawstyle or ds {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure Figure
fillstyle {'full', 'left', 'right', 'bottom', 'top', 'none'}
gid str
in_layout bool
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float
marker marker style string, Path or MarkerStyle
markeredgecolor or mec color
markeredgewidth or mew float
markerfacecolor or mfc color
markerfacecoloralt or mfcalt color
markersize or ms float
markevery None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects AbstractPathEffect
picker float or callable[[Artist, Event], tuple[bool, dict]]
pickradius float
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
solid_capstyle CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
transform unknown
url str
visible bool
xdata 1D array
ydata 1D array
zorder float See also hlines
Add horizontal lines in data coordinates. axhspan
Add a horizontal span (rectangle) across the axis. axline
Add a line with an arbitrary slope. Examples
draw a thick red hline at 'y' = 0 that spans the xrange: >>> axhline(linewidth=4, color='r')
draw a default hline at 'y' = 1 that spans the xrange: >>> axhline(y=1)
draw a default hline at 'y' = .5 that spans the middle half of the xrange: >>> axhline(y=.5, xmin=0.25, xmax=0.75)
Examples using matplotlib.pyplot.axhline
Infinite lines
Zorder Demo
|
matplotlib._as_gen.matplotlib.pyplot.axhline
|
matplotlib.pyplot.axhspan matplotlib.pyplot.axhspan(ymin, ymax, xmin=0, xmax=1, **kwargs)[source]
Add a horizontal span (rectangle) across the Axes. The rectangle spans from ymin to ymax vertically, and, by default, the whole x-axis horizontally. The x-span can be set using xmin (default: 0) and xmax (default: 1) which are in axis units; e.g. xmin = 0.5 always refers to the middle of the x-axis regardless of the limits set by set_xlim. Parameters
yminfloat
Lower y-coordinate of the span, in data units.
ymaxfloat
Upper y-coordinate of the span, in data units.
xminfloat, default: 0
Lower x-coordinate of the span, in x-axis (0-1) units.
xmaxfloat, default: 1
Upper x-coordinate of the span, in x-axis (0-1) units. Returns
Polygon
Horizontal span (rectangle) from (xmin, ymin) to (xmax, ymax). Other Parameters
**kwargsPolygon properties
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
closed bool
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
xy (N, 2) array-like
zorder float See also axvspan
Add a vertical span across the Axes.
|
matplotlib._as_gen.matplotlib.pyplot.axhspan
|
matplotlib.pyplot.axis matplotlib.pyplot.axis(*args, emit=True, **kwargs)[source]
Convenience method to get or set some axis properties. Call signatures: xmin, xmax, ymin, ymax = axis()
xmin, xmax, ymin, ymax = axis([xmin, xmax, ymin, ymax])
xmin, xmax, ymin, ymax = axis(option)
xmin, xmax, ymin, ymax = axis(**kwargs)
Parameters
xmin, xmax, ymin, ymaxfloat, optional
The axis limits to be set. This can also be achieved using ax.set(xlim=(xmin, xmax), ylim=(ymin, ymax))
optionbool or str
If a bool, turns axis lines and labels on or off. If a string, possible values are:
Value Description
'on' Turn on axis lines and labels. Same as True.
'off' Turn off axis lines and labels. Same as False.
'equal' Set equal scaling (i.e., make circles circular) by changing axis limits. This is the same as ax.set_aspect('equal', adjustable='datalim'). Explicit data limits may not be respected in this case.
'scaled' Set equal scaling (i.e., make circles circular) by changing dimensions of the plot box. This is the same as ax.set_aspect('equal', adjustable='box', anchor='C'). Additionally, further autoscaling will be disabled.
'tight' Set limits just large enough to show all data, then disable further autoscaling.
'auto' Automatic scaling (fill plot box with data).
'image' 'scaled' with axis limits equal to data limits.
'square' Square plot; similar to 'scaled', but initially forcing xmax-xmin == ymax-ymin.
emitbool, default: True
Whether observers are notified of the axis limit change. This option is passed on to set_xlim and set_ylim. Returns
xmin, xmax, ymin, ymaxfloat
The axis limits. See also matplotlib.axes.Axes.set_xlim
matplotlib.axes.Axes.set_ylim
Examples using matplotlib.pyplot.axis
Filled polygon
Auto-wrapping text
Reference for Matplotlib artists
Pyplot tutorial
|
matplotlib._as_gen.matplotlib.pyplot.axis
|
matplotlib.pyplot.axline matplotlib.pyplot.axline(xy1, xy2=None, *, slope=None, **kwargs)[source]
Add an infinitely long straight line. The line can be defined either by two points xy1 and xy2, or by one point xy1 and a slope. This draws a straight line "on the screen", regardless of the x and y scales, and is thus also suitable for drawing exponential decays in semilog plots, power laws in loglog plots, etc. However, slope should only be used with linear scales; It has no clear meaning for all other scales, and thus the behavior is undefined. Please specify the line using the points xy1, xy2 for non-linear scales. The transform keyword argument only applies to the points xy1, xy2. The slope (if given) is always in data coordinates. This can be used e.g. with ax.transAxes for drawing grid lines with a fixed slope. Parameters
xy1, xy2(float, float)
Points for the line to pass through. Either xy2 or slope has to be given.
slopefloat, optional
The slope of the line. Either xy2 or slope has to be given. Returns
Line2D
Other Parameters
**kwargs
Valid kwargs are Line2D properties
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color or c color
dash_capstyle CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
dashes sequence of floats (on/off ink in points) or (None, None)
data (2, N) array or two 1D arrays
drawstyle or ds {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure Figure
fillstyle {'full', 'left', 'right', 'bottom', 'top', 'none'}
gid str
in_layout bool
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float
marker marker style string, Path or MarkerStyle
markeredgecolor or mec color
markeredgewidth or mew float
markerfacecolor or mfc color
markerfacecoloralt or mfcalt color
markersize or ms float
markevery None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects AbstractPathEffect
picker float or callable[[Artist, Event], tuple[bool, dict]]
pickradius float
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
solid_capstyle CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
transform unknown
url str
visible bool
xdata 1D array
ydata 1D array
zorder float See also axhline
for horizontal lines axvline
for vertical lines Examples Draw a thick red line passing through (0, 0) and (1, 1): >>> axline((0, 0), (1, 1), linewidth=4, color='r')
Examples using matplotlib.pyplot.axline
Infinite lines
|
matplotlib._as_gen.matplotlib.pyplot.axline
|
matplotlib.pyplot.axvline matplotlib.pyplot.axvline(x=0, ymin=0, ymax=1, **kwargs)[source]
Add a vertical line across the Axes. Parameters
xfloat, default: 0
x position in data coordinates of the vertical line.
yminfloat, default: 0
Should be between 0 and 1, 0 being the bottom of the plot, 1 the top of the plot.
ymaxfloat, default: 1
Should be between 0 and 1, 0 being the bottom of the plot, 1 the top of the plot. Returns
Line2D
Other Parameters
**kwargs
Valid keyword arguments are Line2D properties, with the exception of 'transform':
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color or c color
dash_capstyle CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
dashes sequence of floats (on/off ink in points) or (None, None)
data (2, N) array or two 1D arrays
drawstyle or ds {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure Figure
fillstyle {'full', 'left', 'right', 'bottom', 'top', 'none'}
gid str
in_layout bool
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float
marker marker style string, Path or MarkerStyle
markeredgecolor or mec color
markeredgewidth or mew float
markerfacecolor or mfc color
markerfacecoloralt or mfcalt color
markersize or ms float
markevery None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects AbstractPathEffect
picker float or callable[[Artist, Event], tuple[bool, dict]]
pickradius float
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
solid_capstyle CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
transform unknown
url str
visible bool
xdata 1D array
ydata 1D array
zorder float See also vlines
Add vertical lines in data coordinates. axvspan
Add a vertical span (rectangle) across the axis. axline
Add a line with an arbitrary slope. Examples
draw a thick red vline at x = 0 that spans the yrange: >>> axvline(linewidth=4, color='r')
draw a default vline at x = 1 that spans the yrange: >>> axvline(x=1)
draw a default vline at x = .5 that spans the middle half of the yrange: >>> axvline(x=.5, ymin=0.25, ymax=0.75)
Examples using matplotlib.pyplot.axvline
Infinite lines
|
matplotlib._as_gen.matplotlib.pyplot.axvline
|
matplotlib.pyplot.axvspan matplotlib.pyplot.axvspan(xmin, xmax, ymin=0, ymax=1, **kwargs)[source]
Add a vertical span (rectangle) across the Axes. The rectangle spans from xmin to xmax horizontally, and, by default, the whole y-axis vertically. The y-span can be set using ymin (default: 0) and ymax (default: 1) which are in axis units; e.g. ymin = 0.5 always refers to the middle of the y-axis regardless of the limits set by set_ylim. Parameters
xminfloat
Lower x-coordinate of the span, in data units.
xmaxfloat
Upper x-coordinate of the span, in data units.
yminfloat, default: 0
Lower y-coordinate of the span, in y-axis units (0-1).
ymaxfloat, default: 1
Upper y-coordinate of the span, in y-axis units (0-1). Returns
Polygon
Vertical span (rectangle) from (xmin, ymin) to (xmax, ymax). Other Parameters
**kwargsPolygon properties
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
closed bool
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
xy (N, 2) array-like
zorder float See also axhspan
Add a horizontal span across the Axes. Examples Draw a vertical, green, translucent rectangle from x = 1.25 to x = 1.55 that spans the yrange of the Axes. >>> axvspan(1.25, 1.55, facecolor='g', alpha=0.5)
|
matplotlib._as_gen.matplotlib.pyplot.axvspan
|
matplotlib.pyplot.bar matplotlib.pyplot.bar(x, height, width=0.8, bottom=None, *, align='center', data=None, **kwargs)[source]
Make a bar plot. The bars are positioned at x with the given alignment. Their dimensions are given by height and width. The vertical baseline is bottom (default 0). Many parameters can take either a single value applying to all bars or a sequence of values, one for each bar. Parameters
xfloat or array-like
The x coordinates of the bars. See also align for the alignment of the bars to the coordinates.
heightfloat or array-like
The height(s) of the bars.
widthfloat or array-like, default: 0.8
The width(s) of the bars.
bottomfloat or array-like, default: 0
The y coordinate(s) of the bars bases.
align{'center', 'edge'}, default: 'center'
Alignment of the bars to the x coordinates: 'center': Center the base on the x positions. 'edge': Align the left edges of the bars with the x positions. To align the bars on the right edge pass a negative width and align='edge'. Returns
BarContainer
Container with all the bars and optionally errorbars. Other Parameters
colorcolor or list of color, optional
The colors of the bar faces.
edgecolorcolor or list of color, optional
The colors of the bar edges.
linewidthfloat or array-like, optional
Width of the bar edge(s). If 0, don't draw edges.
tick_labelstr or list of str, optional
The tick labels of the bars. Default: None (Use default numeric labels.)
xerr, yerrfloat or array-like of shape(N,) or shape(2, N), optional
If not None, add horizontal / vertical errorbars to the bar tips. The values are +/- sizes relative to the data: scalar: symmetric +/- values for all bars shape(N,): symmetric +/- values for each bar shape(2, N): Separate - and + values for each bar. First row contains the lower errors, the second row contains the upper errors.
None: No errorbar. (Default) See Different ways of specifying error bars for an example on the usage of xerr and yerr.
ecolorcolor or list of color, default: 'black'
The line color of the errorbars.
capsizefloat, default: rcParams["errorbar.capsize"] (default: 0.0)
The length of the error bar caps in points.
error_kwdict, optional
Dictionary of kwargs to be passed to the errorbar method. Values of ecolor or capsize defined here take precedence over the independent kwargs.
logbool, default: False
If True, set the y-axis to be log scale.
dataindexable object, optional
If given, all parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception).
**kwargsRectangle properties
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
angle unknown
animated bool
antialiased or aa bool or None
bounds (left, bottom, width, height)
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
height unknown
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
width unknown
x unknown
xy (float, float)
y unknown
zorder float See also barh
Plot a horizontal bar plot. Notes Stacked bars can be achieved by passing individual bottom values per bar. See Stacked bar chart.
Examples using matplotlib.pyplot.bar
Table Demo
Pyplot tutorial
|
matplotlib._as_gen.matplotlib.pyplot.bar
|
matplotlib.pyplot.bar_label matplotlib.pyplot.bar_label(container, labels=None, *, fmt='%g', label_type='edge', padding=0, **kwargs)[source]
Label a bar plot. Adds labels to bars in the given BarContainer. You may need to adjust the axis limits to fit the labels. Parameters
containerBarContainer
Container with all the bars and optionally errorbars, likely returned from bar or barh.
labelsarray-like, optional
A list of label texts, that should be displayed. If not given, the label texts will be the data values formatted with fmt.
fmtstr, default: '%g'
A format string for the label.
label_type{'edge', 'center'}, default: 'edge'
The label type. Possible values: 'edge': label placed at the end-point of the bar segment, and the value displayed will be the position of that end-point. 'center': label placed in the center of the bar segment, and the value displayed will be the length of that segment. (useful for stacked bars, i.e., Bar Label Demo)
paddingfloat, default: 0
Distance of label from the end of the bar, in points. **kwargs
Any remaining keyword arguments are passed through to Axes.annotate. Returns
list of Text
A list of Text instances for the labels.
|
matplotlib._as_gen.matplotlib.pyplot.bar_label
|
matplotlib.pyplot.barbs matplotlib.pyplot.barbs(*args, data=None, **kwargs)[source]
Plot a 2D field of barbs. Call signature: barbs([X, Y], U, V, [C], **kw)
Where X, Y define the barb locations, U, V define the barb directions, and C optionally sets the color. All arguments may be 1D or 2D. U, V, C may be masked arrays, but masked X, Y are not supported at present. Barbs are traditionally used in meteorology as a way to plot the speed and direction of wind observations, but can technically be used to plot any two dimensional vector quantity. As opposed to arrows, which give vector magnitude by the length of the arrow, the barbs give more quantitative information about the vector magnitude by putting slanted lines or a triangle for various increments in magnitude, as show schematically below: : /\ \
: / \ \
: / \ \ \
: / \ \ \
: ------------------------------
The largest increment is given by a triangle (or "flag"). After those come full lines (barbs). The smallest increment is a half line. There is only, of course, ever at most 1 half line. If the magnitude is small and only needs a single half-line and no full lines or triangles, the half-line is offset from the end of the barb so that it can be easily distinguished from barbs with a single full line. The magnitude for the barb shown above would nominally be 65, using the standard increments of 50, 10, and 5. See also https://en.wikipedia.org/wiki/Wind_barb. Parameters
X, Y1D or 2D array-like, optional
The x and y coordinates of the barb locations. See pivot for how the barbs are drawn to the x, y positions. If not given, they will be generated as a uniform integer meshgrid based on the dimensions of U and V. If X and Y are 1D but U, V are 2D, X, Y are expanded to 2D using X, Y = np.meshgrid(X, Y). In this case len(X) and len(Y) must match the column and row dimensions of U and V.
U, V1D or 2D array-like
The x and y components of the barb shaft.
C1D or 2D array-like, optional
Numeric data that defines the barb colors by colormapping via norm and cmap. This does not support explicit colors. If you want to set colors directly, use barbcolor instead.
lengthfloat, default: 7
Length of the barb in points; the other parts of the barb are scaled against this.
pivot{'tip', 'middle'} or float, default: 'tip'
The part of the arrow that is anchored to the X, Y grid. The barb rotates about this point. This can also be a number, which shifts the start of the barb that many points away from grid point.
barbcolorcolor or color sequence
The color of all parts of the barb except for the flags. This parameter is analogous to the edgecolor parameter for polygons, which can be used instead. However this parameter will override facecolor.
flagcolorcolor or color sequence
The color of any flags on the barb. This parameter is analogous to the facecolor parameter for polygons, which can be used instead. However, this parameter will override facecolor. If this is not set (and C has not either) then flagcolor will be set to match barbcolor so that the barb has a uniform color. If C has been set, flagcolor has no effect.
sizesdict, optional
A dictionary of coefficients specifying the ratio of a given feature to the length of the barb. Only those values one wishes to override need to be included. These features include: 'spacing' - space between features (flags, full/half barbs) 'height' - height (distance from shaft to top) of a flag or full barb 'width' - width of a flag, twice the width of a full barb 'emptybarb' - radius of the circle used for low magnitudes
fill_emptybool, default: False
Whether the empty barbs (circles) that are drawn should be filled with the flag color. If they are not filled, the center is transparent.
roundingbool, default: True
Whether the vector magnitude should be rounded when allocating barb components. If True, the magnitude is rounded to the nearest multiple of the half-barb increment. If False, the magnitude is simply truncated to the next lowest multiple.
barb_incrementsdict, optional
A dictionary of increments specifying values to associate with different parts of the barb. Only those values one wishes to override need to be included. 'half' - half barbs (Default is 5) 'full' - full barbs (Default is 10) 'flag' - flags (default is 50)
flip_barbbool or array-like of bool, default: False
Whether the lines and flags should point opposite to normal. Normal behavior is for the barbs and lines to point right (comes from wind barbs having these features point towards low pressure in the Northern Hemisphere). A single value is applied to all barbs. Individual barbs can be flipped by passing a bool array of the same size as U and V. Returns
barbsBarbs
Other Parameters
dataindexable object, optional
If given, all parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception). **kwargs
The barbs can further be customized using PolyCollection keyword arguments:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
edgecolor or ec or edgecolors color or list of colors or 'face'
facecolor or facecolors or fc color or list of colors
figure Figure
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or dashes or linestyles or ls str or tuple or list thereof
linewidth or linewidths or lw float or list of floats
norm Normalize or None
offset_transform Transform
offsets (N, 2) or (2,) array-like
path_effects AbstractPathEffect
paths list of array-like
picker None or bool or float or callable
pickradius float
rasterized bool
sizes ndarray or None
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
urls list of str or None
verts list of array-like
verts_and_codes unknown
visible bool
zorder float
|
matplotlib._as_gen.matplotlib.pyplot.barbs
|
matplotlib.pyplot.barh matplotlib.pyplot.barh(y, width, height=0.8, left=None, *, align='center', **kwargs)[source]
Make a horizontal bar plot. The bars are positioned at y with the given alignment. Their dimensions are given by width and height. The horizontal baseline is left (default 0). Many parameters can take either a single value applying to all bars or a sequence of values, one for each bar. Parameters
yfloat or array-like
The y coordinates of the bars. See also align for the alignment of the bars to the coordinates.
widthfloat or array-like
The width(s) of the bars.
heightfloat or array-like, default: 0.8
The heights of the bars.
leftfloat or array-like, default: 0
The x coordinates of the left sides of the bars.
align{'center', 'edge'}, default: 'center'
Alignment of the base to the y coordinates*: 'center': Center the bars on the y positions. 'edge': Align the bottom edges of the bars with the y positions. To align the bars on the top edge pass a negative height and align='edge'. Returns
BarContainer
Container with all the bars and optionally errorbars. Other Parameters
colorcolor or list of color, optional
The colors of the bar faces.
edgecolorcolor or list of color, optional
The colors of the bar edges.
linewidthfloat or array-like, optional
Width of the bar edge(s). If 0, don't draw edges.
tick_labelstr or list of str, optional
The tick labels of the bars. Default: None (Use default numeric labels.)
xerr, yerrfloat or array-like of shape(N,) or shape(2, N), optional
If not None, add horizontal / vertical errorbars to the bar tips. The values are +/- sizes relative to the data: scalar: symmetric +/- values for all bars shape(N,): symmetric +/- values for each bar shape(2, N): Separate - and + values for each bar. First row contains the lower errors, the second row contains the upper errors.
None: No errorbar. (default) See Different ways of specifying error bars for an example on the usage of xerr and yerr.
ecolorcolor or list of color, default: 'black'
The line color of the errorbars.
capsizefloat, default: rcParams["errorbar.capsize"] (default: 0.0)
The length of the error bar caps in points.
error_kwdict, optional
Dictionary of kwargs to be passed to the errorbar method. Values of ecolor or capsize defined here take precedence over the independent kwargs.
logbool, default: False
If True, set the x-axis to be log scale.
**kwargsRectangle properties
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
angle unknown
animated bool
antialiased or aa bool or None
bounds (left, bottom, width, height)
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
height unknown
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
width unknown
x unknown
xy (float, float)
y unknown
zorder float See also bar
Plot a vertical bar plot. Notes Stacked bars can be achieved by passing individual left values per bar. See Discrete distribution as horizontal bar chart .
|
matplotlib._as_gen.matplotlib.pyplot.barh
|
matplotlib.pyplot.bone matplotlib.pyplot.bone()[source]
Set the colormap to 'bone'. This changes the default colormap as well as the colormap of the current image if there is one. See help(colormaps) for more information.
|
matplotlib._as_gen.matplotlib.pyplot.bone
|
matplotlib.pyplot.box matplotlib.pyplot.box(on=None)[source]
Turn the axes box on or off on the current axes. Parameters
onbool or None
The new Axes box state. If None, toggle the state. See also matplotlib.axes.Axes.set_frame_on()
matplotlib.axes.Axes.get_frame_on()
|
matplotlib._as_gen.matplotlib.pyplot.box
|
matplotlib.pyplot.boxplot matplotlib.pyplot.boxplot(x, notch=None, sym=None, vert=None, whis=None, positions=None, widths=None, patch_artist=None, bootstrap=None, usermedians=None, conf_intervals=None, meanline=None, showmeans=None, showcaps=None, showbox=None, showfliers=None, boxprops=None, labels=None, flierprops=None, medianprops=None, meanprops=None, capprops=None, whiskerprops=None, manage_ticks=True, autorange=False, zorder=None, *, data=None)[source]
Draw a box and whisker plot. The box extends from the first quartile (Q1) to the third quartile (Q3) of the data, with a line at the median. The whiskers extend from the box by 1.5x the inter-quartile range (IQR). Flier points are those past the end of the whiskers. See https://en.wikipedia.org/wiki/Box_plot for reference. Q1-1.5IQR Q1 median Q3 Q3+1.5IQR
|-----:-----|
o |--------| : |--------| o o
|-----:-----|
flier <-----------> fliers
IQR
Parameters
xArray or a sequence of vectors.
The input data. If a 2D array, a boxplot is drawn for each column in x. If a sequence of 1D arrays, a boxplot is drawn for each array in x.
notchbool, default: False
Whether to draw a notched boxplot (True), or a rectangular boxplot (False). The notches represent the confidence interval (CI) around the median. The documentation for bootstrap describes how the locations of the notches are computed by default, but their locations may also be overridden by setting the conf_intervals parameter. Note In cases where the values of the CI are less than the lower quartile or greater than the upper quartile, the notches will extend beyond the box, giving it a distinctive "flipped" appearance. This is expected behavior and consistent with other statistical visualization packages.
symstr, optional
The default symbol for flier points. An empty string ('') hides the fliers. If None, then the fliers default to 'b+'. More control is provided by the flierprops parameter.
vertbool, default: True
If True, draws vertical boxes. If False, draw horizontal boxes.
whisfloat or (float, float), default: 1.5
The position of the whiskers. If a float, the lower whisker is at the lowest datum above Q1 - whis*(Q3-Q1), and the upper whisker at the highest datum below Q3 + whis*(Q3-Q1), where Q1 and Q3 are the first and third quartiles. The default value of whis = 1.5 corresponds to Tukey's original definition of boxplots. If a pair of floats, they indicate the percentiles at which to draw the whiskers (e.g., (5, 95)). In particular, setting this to (0, 100) results in whiskers covering the whole range of the data. In the edge case where Q1 == Q3, whis is automatically set to (0, 100) (cover the whole range of the data) if autorange is True. Beyond the whiskers, data are considered outliers and are plotted as individual points.
bootstrapint, optional
Specifies whether to bootstrap the confidence intervals around the median for notched boxplots. If bootstrap is None, no bootstrapping is performed, and notches are calculated using a Gaussian-based asymptotic approximation (see McGill, R., Tukey, J.W., and Larsen, W.A., 1978, and Kendall and Stuart, 1967). Otherwise, bootstrap specifies the number of times to bootstrap the median to determine its 95% confidence intervals. Values between 1000 and 10000 are recommended.
usermedians1D array-like, optional
A 1D array-like of length len(x). Each entry that is not None forces the value of the median for the corresponding dataset. For entries that are None, the medians are computed by Matplotlib as normal.
conf_intervalsarray-like, optional
A 2D array-like of shape (len(x), 2). Each entry that is not None forces the location of the corresponding notch (which is only drawn if notch is True). For entries that are None, the notches are computed by the method specified by the other parameters (e.g., bootstrap).
positionsarray-like, optional
The positions of the boxes. The ticks and limits are automatically set to match the positions. Defaults to range(1, N+1) where N is the number of boxes to be drawn.
widthsfloat or array-like
The widths of the boxes. The default is 0.5, or 0.15*(distance
between extreme positions), if that is smaller.
patch_artistbool, default: False
If False produces boxes with the Line2D artist. Otherwise, boxes are drawn with Patch artists.
labelssequence, optional
Labels for each dataset (one per dataset).
manage_ticksbool, default: True
If True, the tick locations and labels will be adjusted to match the boxplot positions.
autorangebool, default: False
When True and the data are distributed such that the 25th and 75th percentiles are equal, whis is set to (0, 100) such that the whisker ends are at the minimum and maximum of the data.
meanlinebool, default: False
If True (and showmeans is True), will try to render the mean as a line spanning the full width of the box according to meanprops (see below). Not recommended if shownotches is also True. Otherwise, means will be shown as points.
zorderfloat, default: Line2D.zorder = 2
The zorder of the boxplot. Returns
dict
A dictionary mapping each component of the boxplot to a list of the Line2D instances created. That dictionary has the following keys (assuming vertical boxplots):
boxes: the main body of the boxplot showing the quartiles and the median's confidence intervals if enabled.
medians: horizontal lines at the median of each box.
whiskers: the vertical lines extending to the most extreme, non-outlier data points.
caps: the horizontal lines at the ends of the whiskers.
fliers: points representing data that extend beyond the whiskers (fliers).
means: points or lines representing the means. Other Parameters
showcapsbool, default: True
Show the caps on the ends of whiskers.
showboxbool, default: True
Show the central box.
showfliersbool, default: True
Show the outliers beyond the caps.
showmeansbool, default: False
Show the arithmetic means.
cappropsdict, default: None
The style of the caps.
boxpropsdict, default: None
The style of the box.
whiskerpropsdict, default: None
The style of the whiskers.
flierpropsdict, default: None
The style of the fliers.
medianpropsdict, default: None
The style of the median.
meanpropsdict, default: None
The style of the mean.
dataindexable object, optional
If given, all parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception). See also violinplot
Draw an estimate of the probability density function.
|
matplotlib._as_gen.matplotlib.pyplot.boxplot
|
matplotlib.pyplot.broken_barh matplotlib.pyplot.broken_barh(xranges, yrange, *, data=None, **kwargs)[source]
Plot a horizontal sequence of rectangles. A rectangle is drawn for each element of xranges. All rectangles have the same vertical position and size defined by yrange. This is a convenience function for instantiating a BrokenBarHCollection, adding it to the Axes and autoscaling the view. Parameters
xrangessequence of tuples (xmin, xwidth)
The x-positions and extends of the rectangles. For each tuple (xmin, xwidth) a rectangle is drawn from xmin to xmin + xwidth.
yrange(ymin, yheight)
The y-position and extend for all the rectangles. Returns
BrokenBarHCollection
Other Parameters
dataindexable object, optional
If given, all parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception).
**kwargsBrokenBarHCollection properties
Each kwarg can be either a single argument applying to all rectangles, e.g.: facecolors='black'
or a sequence of arguments over which is cycled, e.g.: facecolors=('black', 'blue')
would create interleaving black and blue rectangles. Supported keywords:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
edgecolor or ec or edgecolors color or list of colors or 'face'
facecolor or facecolors or fc color or list of colors
figure Figure
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or dashes or linestyles or ls str or tuple or list thereof
linewidth or linewidths or lw float or list of floats
norm Normalize or None
offset_transform Transform
offsets (N, 2) or (2,) array-like
path_effects AbstractPathEffect
paths list of array-like
picker None or bool or float or callable
pickradius float
rasterized bool
sizes ndarray or None
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
urls list of str or None
verts list of array-like
verts_and_codes unknown
visible bool
zorder float
|
matplotlib._as_gen.matplotlib.pyplot.broken_barh
|
matplotlib.pyplot.cla matplotlib.pyplot.cla()[source]
Clear the current axes.
|
matplotlib._as_gen.matplotlib.pyplot.cla
|
matplotlib.pyplot.clabel matplotlib.pyplot.clabel(CS, levels=None, **kwargs)[source]
Label a contour plot. Adds labels to line contours in given ContourSet. Parameters
CSContourSet instance
Line contours to label.
levelsarray-like, optional
A list of level values, that should be labeled. The list must be a subset of CS.levels. If not given, all levels are labeled. **kwargs
All other parameters are documented in clabel.
Examples using matplotlib.pyplot.clabel
Interactive functions
|
matplotlib._as_gen.matplotlib.pyplot.clabel
|
matplotlib.pyplot.clf matplotlib.pyplot.clf()[source]
Clear the current figure.
|
matplotlib._as_gen.matplotlib.pyplot.clf
|
matplotlib.pyplot.clim matplotlib.pyplot.clim(vmin=None, vmax=None)[source]
Set the color limits of the current image. If either vmin or vmax is None, the image min/max respectively will be used for color scaling. If you want to set the clim of multiple images, use set_clim on every image, for example: for im in gca().get_images():
im.set_clim(0, 0.5)
|
matplotlib._as_gen.matplotlib.pyplot.clim
|
matplotlib.pyplot.close matplotlib.pyplot.close(fig=None)[source]
Close a figure window. Parameters
figNone or int or str or Figure
The figure to close. There are a number of ways to specify this:
None: the current figure
Figure: the given Figure instance
int: a figure number
str: a figure name 'all': all figures
Examples using matplotlib.pyplot.close
Pipong
Multipage PDF
Multiprocess
Tight Layout guide
|
matplotlib._as_gen.matplotlib.pyplot.close
|
matplotlib.pyplot.cohere matplotlib.pyplot.cohere(x, y, NFFT=256, Fs=2, Fc=0, detrend=<function detrend_none>, window=<function window_hanning>, noverlap=0, pad_to=None, sides='default', scale_by_freq=None, *, data=None, **kwargs)[source]
Plot the coherence between x and y. Plot the coherence between x and y. Coherence is the normalized cross spectral density: \[C_{xy} = \frac{|P_{xy}|^2}{P_{xx}P_{yy}}\] Parameters
Fsfloat, default: 2
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
windowcallable or ndarray, default: window_hanning
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional
The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
NFFTint, default: 256
The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
detrend{'none', 'mean', 'linear'} or callable, default: 'none'
The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
scale_by_freqbool, default: True
Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
noverlapint, default: 0 (no overlap)
The number of points of overlap between blocks.
Fcint, default: 0
The center frequency of x, which offsets the x extents of the plot to reflect the frequency range used when a signal is acquired and then filtered and downsampled to baseband. Returns
Cxy1-D array
The coherence vector.
freqs1-D array
The frequencies for the elements in Cxy. Other Parameters
dataindexable object, optional
If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception): x, y **kwargs
Keyword arguments control the Line2D properties:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color or c color
dash_capstyle CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
dashes sequence of floats (on/off ink in points) or (None, None)
data (2, N) array or two 1D arrays
drawstyle or ds {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure Figure
fillstyle {'full', 'left', 'right', 'bottom', 'top', 'none'}
gid str
in_layout bool
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float
marker marker style string, Path or MarkerStyle
markeredgecolor or mec color
markeredgewidth or mew float
markerfacecolor or mfc color
markerfacecoloralt or mfcalt color
markersize or ms float
markevery None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects AbstractPathEffect
picker float or callable[[Artist, Event], tuple[bool, dict]]
pickradius float
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
solid_capstyle CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
transform unknown
url str
visible bool
xdata 1D array
ydata 1D array
zorder float References Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)
|
matplotlib._as_gen.matplotlib.pyplot.cohere
|
matplotlib.pyplot.colorbar matplotlib.pyplot.colorbar(mappable=None, cax=None, ax=None, **kw)[source]
Add a colorbar to a plot. Parameters
mappable
The matplotlib.cm.ScalarMappable (i.e., AxesImage, ContourSet, etc.) described by this colorbar. This argument is mandatory for the Figure.colorbar method but optional for the pyplot.colorbar function, which sets the default to the current image. Note that one can create a ScalarMappable "on-the-fly" to generate colorbars not attached to a previously drawn artist, e.g. fig.colorbar(cm.ScalarMappable(norm=norm, cmap=cmap), ax=ax)
caxAxes, optional
Axes into which the colorbar will be drawn.
axAxes, list of Axes, optional
One or more parent axes from which space for a new colorbar axes will be stolen, if cax is None. This has no effect if cax is set.
use_gridspecbool, optional
If cax is None, a new cax is created as an instance of Axes. If ax is an instance of Subplot and use_gridspec is True, cax is created as an instance of Subplot using the gridspec module. Returns
colorbarColorbar
Notes Additional keyword arguments are of two kinds: axes properties: locationNone or {'left', 'right', 'top', 'bottom'}
The location, relative to the parent axes, where the colorbar axes is created. It also determines the orientation of the colorbar (colorbars on the left and right are vertical, colorbars at the top and bottom are horizontal). If None, the location will come from the orientation if it is set (vertical colorbars on the right, horizontal ones at the bottom), or default to 'right' if orientation is unset. orientationNone or {'vertical', 'horizontal'}
The orientation of the colorbar. It is preferable to set the location of the colorbar, as that also determines the orientation; passing incompatible values for location and orientation raises an exception. fractionfloat, default: 0.15
Fraction of original axes to use for colorbar. shrinkfloat, default: 1.0
Fraction by which to multiply the size of the colorbar. aspectfloat, default: 20
Ratio of long to short dimensions. padfloat, default: 0.05 if vertical, 0.15 if horizontal
Fraction of original axes between colorbar and new image axes. anchor(float, float), optional
The anchor point of the colorbar axes. Defaults to (0.0, 0.5) if vertical; (0.5, 1.0) if horizontal. panchor(float, float), or False, optional
The anchor point of the colorbar parent axes. If False, the parent axes' anchor will be unchanged. Defaults to (1.0, 0.5) if vertical; (0.5, 0.0) if horizontal. colorbar properties:
Property Description
extend {'neither', 'both', 'min', 'max'} If not 'neither', make pointed end(s) for out-of- range values. These are set for a given colormap using the colormap set_under and set_over methods.
extendfrac {None, 'auto', length, lengths} If set to None, both the minimum and maximum triangular colorbar extensions with have a length of 5% of the interior colorbar length (this is the default setting). If set to 'auto', makes the triangular colorbar extensions the same lengths as the interior boxes (when spacing is set to 'uniform') or the same lengths as the respective adjacent interior boxes (when spacing is set to 'proportional'). If a scalar, indicates the length of both the minimum and maximum triangular colorbar extensions as a fraction of the interior colorbar length. A two-element sequence of fractions may also be given, indicating the lengths of the minimum and maximum colorbar extensions respectively as a fraction of the interior colorbar length.
extendrect bool If False the minimum and maximum colorbar extensions will be triangular (the default). If True the extensions will be rectangular.
spacing {'uniform', 'proportional'} Uniform spacing gives each discrete color the same space; proportional makes the space proportional to the data interval.
ticks None or list of ticks or Locator If None, ticks are determined automatically from the input.
format None or str or Formatter If None, ScalarFormatter is used. If a format string is given, e.g., '%.3f', that is used. An alternative Formatter may be given instead.
drawedges bool Whether to draw lines at color boundaries.
label str The label on the colorbar's long axis. The following will probably be useful only in the context of indexed colors (that is, when the mappable has norm=NoNorm()), or other unusual circumstances.
Property Description
boundaries None or a sequence
values None or a sequence which must be of length 1 less than the sequence of boundaries. For each region delimited by adjacent entries in boundaries, the colormapped to the corresponding value in values will be used. If mappable is a ContourSet, its extend kwarg is included automatically. The shrink kwarg provides a simple way to scale the colorbar with respect to the axes. Note that if cax is specified, it determines the size of the colorbar and shrink and aspect kwargs are ignored. For more precise control, you can manually specify the positions of the axes objects in which the mappable and the colorbar are drawn. In this case, do not use any of the axes properties kwargs. It is known that some vector graphics viewers (svg and pdf) renders white gaps between segments of the colorbar. This is due to bugs in the viewers, not Matplotlib. As a workaround, the colorbar can be rendered with overlapping segments: cbar = colorbar()
cbar.solids.set_edgecolor("face")
draw()
However this has negative consequences in other circumstances, e.g. with semi-transparent images (alpha < 1) and colorbar extensions; therefore, this workaround is not used by default (see issue #1188).
Examples using matplotlib.pyplot.colorbar
Subplots spacings and margins
Ellipse Collection
Axes Divider
Simple Colorbar
Image tutorial
Tight Layout guide
|
matplotlib._as_gen.matplotlib.pyplot.colorbar
|
matplotlib.pyplot.colormaps[source]
Container for colormaps that are known to Matplotlib by name. Experimental While we expect the API to be final, we formally mark it as experimental for 3.5 because we want to keep the option to still adapt the API for 3.6 should the need arise. The universal registry instance is matplotlib.colormaps. There should be no need for users to instantiate ColormapRegistry themselves. Read access uses a dict-like interface mapping names to Colormaps: import matplotlib as mpl
cmap = mpl.colormaps['viridis']
Returned Colormaps are copies, so that their modification does not change the global definition of the colormap. Additional colormaps can be added via ColormapRegistry.register: mpl.colormaps.register(my_colormap)
|
matplotlib.pyplot_summary#matplotlib.pyplot.colormaps
|
matplotlib.pyplot.connect matplotlib.pyplot.connect(s, func)[source]
Bind function func to event s. Parameters
sstr
One of the following events ids: 'button_press_event' 'button_release_event' 'draw_event' 'key_press_event' 'key_release_event' 'motion_notify_event' 'pick_event' 'resize_event' 'scroll_event' 'figure_enter_event', 'figure_leave_event', 'axes_enter_event', 'axes_leave_event' 'close_event'.
funccallable
The callback function to be executed, which must have the signature: def func(event: Event) -> Any
For the location events (button and key press/release), if the mouse is over the axes, the inaxes attribute of the event will be set to the Axes the event occurs is over, and additionally, the variables xdata and ydata attributes will be set to the mouse location in data coordinates. See KeyEvent and MouseEvent for more info. Returns
cid
A connection id that can be used with FigureCanvasBase.mpl_disconnect. Examples def on_press(event):
print('you pressed', event.button, event.xdata, event.ydata)
cid = canvas.mpl_connect('button_press_event', on_press)
Examples using matplotlib.pyplot.connect
Mouse move and click events
|
matplotlib._as_gen.matplotlib.pyplot.connect
|
matplotlib.pyplot.contour matplotlib.pyplot.contour(*args, data=None, **kwargs)[source]
Plot contour lines. Call signature: contour([X, Y,] Z, [levels], **kwargs)
contour and contourf draw contour lines and filled contours, respectively. Except as noted, function signatures and return values are the same for both versions. Parameters
X, Yarray-like, optional
The coordinates of the values in Z. X and Y must both be 2D with the same shape as Z (e.g. created via numpy.meshgrid), or they must both be 1-D such that len(X) == N is the number of columns in Z and len(Y) == M is the number of rows in Z. X and Y must both be ordered monotonically. If not given, they are assumed to be integer indices, i.e. X = range(N), Y = range(M).
Z(M, N) array-like
The height values over which the contour is drawn.
levelsint or array-like, optional
Determines the number and positions of the contour lines / regions. If an int n, use MaxNLocator, which tries to automatically choose no more than n+1 "nice" contour levels between vmin and vmax. If array-like, draw contour lines at the specified levels. The values must be in increasing order. Returns
QuadContourSet
Other Parameters
corner_maskbool, default: rcParams["contour.corner_mask"] (default: True)
Enable/disable corner masking, which only has an effect if Z is a masked array. If False, any quad touching a masked point is masked out. If True, only the triangular corners of quads nearest those points are always masked out, other triangular corners comprising three unmasked points are contoured as usual.
colorscolor string or sequence of colors, optional
The colors of the levels, i.e. the lines for contour and the areas for contourf. The sequence is cycled for the levels in ascending order. If the sequence is shorter than the number of levels, it's repeated. As a shortcut, single color strings may be used in place of one-element lists, i.e. 'red' instead of ['red'] to color all levels with the same color. This shortcut does only work for color strings, not for other ways of specifying colors. By default (value None), the colormap specified by cmap will be used.
alphafloat, default: 1
The alpha blending value, between 0 (transparent) and 1 (opaque).
cmapstr or Colormap, default: rcParams["image.cmap"] (default: 'viridis')
A Colormap instance or registered colormap name. The colormap maps the level values to colors. If both colors and cmap are given, an error is raised.
normNormalize, optional
If a colormap is used, the Normalize instance scales the level values to the canonical colormap range [0, 1] for mapping to colors. If not given, the default linear scaling is used.
vmin, vmaxfloat, optional
If not None, either or both of these values will be supplied to the Normalize instance, overriding the default color scaling based on levels.
origin{None, 'upper', 'lower', 'image'}, default: None
Determines the orientation and exact position of Z by specifying the position of Z[0, 0]. This is only relevant, if X, Y are not given.
None: Z[0, 0] is at X=0, Y=0 in the lower left corner. 'lower': Z[0, 0] is at X=0.5, Y=0.5 in the lower left corner. 'upper': Z[0, 0] is at X=N+0.5, Y=0.5 in the upper left corner. 'image': Use the value from rcParams["image.origin"] (default: 'upper').
extent(x0, x1, y0, y1), optional
If origin is not None, then extent is interpreted as in imshow: it gives the outer pixel boundaries. In this case, the position of Z[0, 0] is the center of the pixel, not a corner. If origin is None, then (x0, y0) is the position of Z[0, 0], and (x1, y1) is the position of Z[-1, -1]. This argument is ignored if X and Y are specified in the call to contour.
locatorticker.Locator subclass, optional
The locator is used to determine the contour levels if they are not given explicitly via levels. Defaults to MaxNLocator.
extend{'neither', 'both', 'min', 'max'}, default: 'neither'
Determines the contourf-coloring of values that are outside the levels range. If 'neither', values outside the levels range are not colored. If 'min', 'max' or 'both', color the values below, above or below and above the levels range. Values below min(levels) and above max(levels) are mapped to the under/over values of the Colormap. Note that most colormaps do not have dedicated colors for these by default, so that the over and under values are the edge values of the colormap. You may want to set these values explicitly using Colormap.set_under and Colormap.set_over. Note An existing QuadContourSet does not get notified if properties of its colormap are changed. Therefore, an explicit call QuadContourSet.changed() is needed after modifying the colormap. The explicit call can be left out, if a colorbar is assigned to the QuadContourSet because it internally calls QuadContourSet.changed(). Example: x = np.arange(1, 10)
y = x.reshape(-1, 1)
h = x * y
cs = plt.contourf(h, levels=[10, 30, 50],
colors=['#808080', '#A0A0A0', '#C0C0C0'], extend='both')
cs.cmap.set_over('red')
cs.cmap.set_under('blue')
cs.changed()
xunits, yunitsregistered units, optional
Override axis units by specifying an instance of a matplotlib.units.ConversionInterface.
antialiasedbool, optional
Enable antialiasing, overriding the defaults. For filled contours, the default is True. For line contours, it is taken from rcParams["lines.antialiased"] (default: True).
nchunkint >= 0, optional
If 0, no subdivision of the domain. Specify a positive integer to divide the domain into subdomains of nchunk by nchunk quads. Chunking reduces the maximum length of polygons generated by the contouring algorithm which reduces the rendering workload passed on to the backend and also requires slightly less RAM. It can however introduce rendering artifacts at chunk boundaries depending on the backend, the antialiased flag and value of alpha.
linewidthsfloat or array-like, default: rcParams["contour.linewidth"] (default: None)
Only applies to contour. The line width of the contour lines. If a number, all levels will be plotted with this linewidth. If a sequence, the levels in ascending order will be plotted with the linewidths in the order specified. If None, this falls back to rcParams["lines.linewidth"] (default: 1.5).
linestyles{None, 'solid', 'dashed', 'dashdot', 'dotted'}, optional
Only applies to contour. If linestyles is None, the default is 'solid' unless the lines are monochrome. In that case, negative contours will take their linestyle from rcParams["contour.negative_linestyle"] (default: 'dashed') setting. linestyles can also be an iterable of the above strings specifying a set of linestyles to be used. If this iterable is shorter than the number of contour levels it will be repeated as necessary.
hatcheslist[str], optional
Only applies to contourf. A list of cross hatch patterns to use on the filled areas. If None, no hatching will be added to the contour. Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
dataindexable object, optional
If given, all parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception). Notes
contourf differs from the MATLAB version in that it does not draw the polygon edges. To draw edges, add line contours with calls to contour.
contourf fills intervals that are closed at the top; that is, for boundaries z1 and z2, the filled region is: z1 < Z <= z2
except for the lowest interval, which is closed on both sides (i.e. it includes the lowest value).
contour and contourf use a marching squares algorithm to compute contour locations. More information can be found in the source src/_contour.h.
Examples using matplotlib.pyplot.contour
Interactive functions
|
matplotlib._as_gen.matplotlib.pyplot.contour
|
matplotlib.pyplot.contourf matplotlib.pyplot.contourf(*args, data=None, **kwargs)[source]
Plot filled contours. Call signature: contourf([X, Y,] Z, [levels], **kwargs)
contour and contourf draw contour lines and filled contours, respectively. Except as noted, function signatures and return values are the same for both versions. Parameters
X, Yarray-like, optional
The coordinates of the values in Z. X and Y must both be 2D with the same shape as Z (e.g. created via numpy.meshgrid), or they must both be 1-D such that len(X) == N is the number of columns in Z and len(Y) == M is the number of rows in Z. X and Y must both be ordered monotonically. If not given, they are assumed to be integer indices, i.e. X = range(N), Y = range(M).
Z(M, N) array-like
The height values over which the contour is drawn.
levelsint or array-like, optional
Determines the number and positions of the contour lines / regions. If an int n, use MaxNLocator, which tries to automatically choose no more than n+1 "nice" contour levels between vmin and vmax. If array-like, draw contour lines at the specified levels. The values must be in increasing order. Returns
QuadContourSet
Other Parameters
corner_maskbool, default: rcParams["contour.corner_mask"] (default: True)
Enable/disable corner masking, which only has an effect if Z is a masked array. If False, any quad touching a masked point is masked out. If True, only the triangular corners of quads nearest those points are always masked out, other triangular corners comprising three unmasked points are contoured as usual.
colorscolor string or sequence of colors, optional
The colors of the levels, i.e. the lines for contour and the areas for contourf. The sequence is cycled for the levels in ascending order. If the sequence is shorter than the number of levels, it's repeated. As a shortcut, single color strings may be used in place of one-element lists, i.e. 'red' instead of ['red'] to color all levels with the same color. This shortcut does only work for color strings, not for other ways of specifying colors. By default (value None), the colormap specified by cmap will be used.
alphafloat, default: 1
The alpha blending value, between 0 (transparent) and 1 (opaque).
cmapstr or Colormap, default: rcParams["image.cmap"] (default: 'viridis')
A Colormap instance or registered colormap name. The colormap maps the level values to colors. If both colors and cmap are given, an error is raised.
normNormalize, optional
If a colormap is used, the Normalize instance scales the level values to the canonical colormap range [0, 1] for mapping to colors. If not given, the default linear scaling is used.
vmin, vmaxfloat, optional
If not None, either or both of these values will be supplied to the Normalize instance, overriding the default color scaling based on levels.
origin{None, 'upper', 'lower', 'image'}, default: None
Determines the orientation and exact position of Z by specifying the position of Z[0, 0]. This is only relevant, if X, Y are not given.
None: Z[0, 0] is at X=0, Y=0 in the lower left corner. 'lower': Z[0, 0] is at X=0.5, Y=0.5 in the lower left corner. 'upper': Z[0, 0] is at X=N+0.5, Y=0.5 in the upper left corner. 'image': Use the value from rcParams["image.origin"] (default: 'upper').
extent(x0, x1, y0, y1), optional
If origin is not None, then extent is interpreted as in imshow: it gives the outer pixel boundaries. In this case, the position of Z[0, 0] is the center of the pixel, not a corner. If origin is None, then (x0, y0) is the position of Z[0, 0], and (x1, y1) is the position of Z[-1, -1]. This argument is ignored if X and Y are specified in the call to contour.
locatorticker.Locator subclass, optional
The locator is used to determine the contour levels if they are not given explicitly via levels. Defaults to MaxNLocator.
extend{'neither', 'both', 'min', 'max'}, default: 'neither'
Determines the contourf-coloring of values that are outside the levels range. If 'neither', values outside the levels range are not colored. If 'min', 'max' or 'both', color the values below, above or below and above the levels range. Values below min(levels) and above max(levels) are mapped to the under/over values of the Colormap. Note that most colormaps do not have dedicated colors for these by default, so that the over and under values are the edge values of the colormap. You may want to set these values explicitly using Colormap.set_under and Colormap.set_over. Note An existing QuadContourSet does not get notified if properties of its colormap are changed. Therefore, an explicit call QuadContourSet.changed() is needed after modifying the colormap. The explicit call can be left out, if a colorbar is assigned to the QuadContourSet because it internally calls QuadContourSet.changed(). Example: x = np.arange(1, 10)
y = x.reshape(-1, 1)
h = x * y
cs = plt.contourf(h, levels=[10, 30, 50],
colors=['#808080', '#A0A0A0', '#C0C0C0'], extend='both')
cs.cmap.set_over('red')
cs.cmap.set_under('blue')
cs.changed()
xunits, yunitsregistered units, optional
Override axis units by specifying an instance of a matplotlib.units.ConversionInterface.
antialiasedbool, optional
Enable antialiasing, overriding the defaults. For filled contours, the default is True. For line contours, it is taken from rcParams["lines.antialiased"] (default: True).
nchunkint >= 0, optional
If 0, no subdivision of the domain. Specify a positive integer to divide the domain into subdomains of nchunk by nchunk quads. Chunking reduces the maximum length of polygons generated by the contouring algorithm which reduces the rendering workload passed on to the backend and also requires slightly less RAM. It can however introduce rendering artifacts at chunk boundaries depending on the backend, the antialiased flag and value of alpha.
linewidthsfloat or array-like, default: rcParams["contour.linewidth"] (default: None)
Only applies to contour. The line width of the contour lines. If a number, all levels will be plotted with this linewidth. If a sequence, the levels in ascending order will be plotted with the linewidths in the order specified. If None, this falls back to rcParams["lines.linewidth"] (default: 1.5).
linestyles{None, 'solid', 'dashed', 'dashdot', 'dotted'}, optional
Only applies to contour. If linestyles is None, the default is 'solid' unless the lines are monochrome. In that case, negative contours will take their linestyle from rcParams["contour.negative_linestyle"] (default: 'dashed') setting. linestyles can also be an iterable of the above strings specifying a set of linestyles to be used. If this iterable is shorter than the number of contour levels it will be repeated as necessary.
hatcheslist[str], optional
Only applies to contourf. A list of cross hatch patterns to use on the filled areas. If None, no hatching will be added to the contour. Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
dataindexable object, optional
If given, all parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception). Notes
contourf differs from the MATLAB version in that it does not draw the polygon edges. To draw edges, add line contours with calls to contour.
contourf fills intervals that are closed at the top; that is, for boundaries z1 and z2, the filled region is: z1 < Z <= z2
except for the lowest interval, which is closed on both sides (i.e. it includes the lowest value).
contour and contourf use a marching squares algorithm to compute contour locations. More information can be found in the source src/_contour.h.
|
matplotlib._as_gen.matplotlib.pyplot.contourf
|
matplotlib.pyplot.cool matplotlib.pyplot.cool()[source]
Set the colormap to 'cool'. This changes the default colormap as well as the colormap of the current image if there is one. See help(colormaps) for more information.
|
matplotlib._as_gen.matplotlib.pyplot.cool
|
matplotlib.pyplot.copper matplotlib.pyplot.copper()[source]
Set the colormap to 'copper'. This changes the default colormap as well as the colormap of the current image if there is one. See help(colormaps) for more information.
|
matplotlib._as_gen.matplotlib.pyplot.copper
|
matplotlib.pyplot.csd matplotlib.pyplot.csd(x, y, NFFT=None, Fs=None, Fc=None, detrend=None, window=None, noverlap=None, pad_to=None, sides=None, scale_by_freq=None, return_line=None, *, data=None, **kwargs)[source]
Plot the cross-spectral density. The cross spectral density \(P_{xy}\) by Welch's average periodogram method. The vectors x and y are divided into NFFT length segments. Each segment is detrended by function detrend and windowed by function window. noverlap gives the length of the overlap between segments. The product of the direct FFTs of x and y are averaged over each segment to compute \(P_{xy}\), with a scaling to correct for power loss due to windowing. If len(x) < NFFT or len(y) < NFFT, they will be zero padded to NFFT. Parameters
x, y1-D arrays or sequences
Arrays or sequences containing the data.
Fsfloat, default: 2
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
windowcallable or ndarray, default: window_hanning
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional
The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
NFFTint, default: 256
The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
detrend{'none', 'mean', 'linear'} or callable, default: 'none'
The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
scale_by_freqbool, default: True
Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
noverlapint, default: 0 (no overlap)
The number of points of overlap between segments.
Fcint, default: 0
The center frequency of x, which offsets the x extents of the plot to reflect the frequency range used when a signal is acquired and then filtered and downsampled to baseband.
return_linebool, default: False
Whether to include the line object plotted in the returned values. Returns
Pxy1-D array
The values for the cross spectrum \(P_{xy}\) before scaling (complex valued).
freqs1-D array
The frequencies corresponding to the elements in Pxy.
lineLine2D
The line created by this function. Only returned if return_line is True. Other Parameters
dataindexable object, optional
If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception): x, y **kwargs
Keyword arguments control the Line2D properties:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color or c color
dash_capstyle CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
dashes sequence of floats (on/off ink in points) or (None, None)
data (2, N) array or two 1D arrays
drawstyle or ds {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure Figure
fillstyle {'full', 'left', 'right', 'bottom', 'top', 'none'}
gid str
in_layout bool
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float
marker marker style string, Path or MarkerStyle
markeredgecolor or mec color
markeredgewidth or mew float
markerfacecolor or mfc color
markerfacecoloralt or mfcalt color
markersize or ms float
markevery None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects AbstractPathEffect
picker float or callable[[Artist, Event], tuple[bool, dict]]
pickradius float
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
solid_capstyle CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
transform unknown
url str
visible bool
xdata 1D array
ydata 1D array
zorder float See also psd
is equivalent to setting y = x. Notes For plotting, the power is plotted as \(10 \log_{10}(P_{xy})\) for decibels, though \(P_{xy}\) itself is returned. References Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)
|
matplotlib._as_gen.matplotlib.pyplot.csd
|
matplotlib.pyplot.delaxes matplotlib.pyplot.delaxes(ax=None)[source]
Remove an Axes (defaulting to the current axes) from its figure.
|
matplotlib._as_gen.matplotlib.pyplot.delaxes
|
matplotlib.pyplot.disconnect matplotlib.pyplot.disconnect(cid)[source]
Disconnect the callback with id cid. Examples cid = canvas.mpl_connect('button_press_event', on_press)
# ... later
canvas.mpl_disconnect(cid)
Examples using matplotlib.pyplot.disconnect
Mouse move and click events
|
matplotlib._as_gen.matplotlib.pyplot.disconnect
|
matplotlib.pyplot.draw matplotlib.pyplot.draw()[source]
Redraw the current figure. This is used to update a figure that has been altered, but not automatically re-drawn. If interactive mode is on (via ion()), this should be only rarely needed, but there may be ways to modify the state of a figure without marking it as "stale". Please report these cases as bugs. This is equivalent to calling fig.canvas.draw_idle(), where fig is the current figure.
Examples using matplotlib.pyplot.draw
Interactive functions
Rotating a 3D plot
Buttons
Check Buttons
Radio Buttons
Textbox
|
matplotlib._as_gen.matplotlib.pyplot.draw
|
matplotlib.pyplot.draw_if_interactive matplotlib.pyplot.draw_if_interactive()[source]
Redraw the current figure if in interactive mode. Warning End users will typically not have to call this function because the the interactive mode takes care of this.
|
matplotlib._as_gen.matplotlib.pyplot.draw_if_interactive
|
matplotlib.pyplot.errorbar matplotlib.pyplot.errorbar(x, y, yerr=None, xerr=None, fmt='', ecolor=None, elinewidth=None, capsize=None, barsabove=False, lolims=False, uplims=False, xlolims=False, xuplims=False, errorevery=1, capthick=None, *, data=None, **kwargs)[source]
Plot y versus x as lines and/or markers with attached errorbars. x, y define the data locations, xerr, yerr define the errorbar sizes. By default, this draws the data markers/lines as well the errorbars. Use fmt='none' to draw errorbars without any data markers. Parameters
x, yfloat or array-like
The data positions.
xerr, yerrfloat or array-like, shape(N,) or shape(2, N), optional
The errorbar sizes: scalar: Symmetric +/- values for all data points. shape(N,): Symmetric +/-values for each data point. shape(2, N): Separate - and + values for each bar. First row contains the lower errors, the second row contains the upper errors.
None: No errorbar. Note that all error arrays should have positive values. See Different ways of specifying error bars for an example on the usage of xerr and yerr.
fmtstr, default: ''
The format for the data points / data lines. See plot for details. Use 'none' (case insensitive) to plot errorbars without any data markers.
ecolorcolor, default: None
The color of the errorbar lines. If None, use the color of the line connecting the markers.
elinewidthfloat, default: None
The linewidth of the errorbar lines. If None, the linewidth of the current style is used.
capsizefloat, default: rcParams["errorbar.capsize"] (default: 0.0)
The length of the error bar caps in points.
capthickfloat, default: None
An alias to the keyword argument markeredgewidth (a.k.a. mew). This setting is a more sensible name for the property that controls the thickness of the error bar cap in points. For backwards compatibility, if mew or markeredgewidth are given, then they will over-ride capthick. This may change in future releases.
barsabovebool, default: False
If True, will plot the errorbars above the plot symbols. Default is below.
lolims, uplims, xlolims, xuplimsbool, default: False
These arguments can be used to indicate that a value gives only upper/lower limits. In that case a caret symbol is used to indicate this. lims-arguments may be scalars, or array-likes of the same length as xerr and yerr. To use limits with inverted axes, set_xlim or set_ylim must be called before errorbar(). Note the tricky parameter names: setting e.g. lolims to True means that the y-value is a lower limit of the True value, so, only an upward-pointing arrow will be drawn!
erroreveryint or (int, int), default: 1
draws error bars on a subset of the data. errorevery =N draws error bars on the points (x[::N], y[::N]). errorevery =(start, N) draws error bars on the points (x[start::N], y[start::N]). e.g. errorevery=(6, 3) adds error bars to the data at (x[6], x[9], x[12], x[15], ...). Used to avoid overlapping error bars when two series share x-axis values. Returns
ErrorbarContainer
The container contains: plotline: Line2D instance of x, y plot markers and/or line. caplines: A tuple of Line2D instances of the error bar caps. barlinecols: A tuple of LineCollection with the horizontal and vertical error ranges. Other Parameters
dataindexable object, optional
If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception): x, y, xerr, yerr **kwargs
All other keyword arguments are passed on to the plot call drawing the markers. For example, this code makes big red squares with thick green edges: x, y, yerr = rand(3, 10)
errorbar(x, y, yerr, marker='s', mfc='red',
mec='green', ms=20, mew=4)
where mfc, mec, ms and mew are aliases for the longer property names, markerfacecolor, markeredgecolor, markersize and markeredgewidth. Valid kwargs for the marker properties are Line2D properties:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color or c color
dash_capstyle CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
dashes sequence of floats (on/off ink in points) or (None, None)
data (2, N) array or two 1D arrays
drawstyle or ds {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure Figure
fillstyle {'full', 'left', 'right', 'bottom', 'top', 'none'}
gid str
in_layout bool
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float
marker marker style string, Path or MarkerStyle
markeredgecolor or mec color
markeredgewidth or mew float
markerfacecolor or mfc color
markerfacecoloralt or mfcalt color
markersize or ms float
markevery None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects AbstractPathEffect
picker float or callable[[Artist, Event], tuple[bool, dict]]
pickradius float
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
solid_capstyle CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
transform unknown
url str
visible bool
xdata 1D array
ydata 1D array
zorder float
Examples using matplotlib.pyplot.errorbar
Errorbar limit selection
|
matplotlib._as_gen.matplotlib.pyplot.errorbar
|
matplotlib.pyplot.eventplot matplotlib.pyplot.eventplot(positions, orientation='horizontal', lineoffsets=1, linelengths=1, linewidths=None, colors=None, linestyles='solid', *, data=None, **kwargs)[source]
Plot identical parallel lines at the given positions. This type of plot is commonly used in neuroscience for representing neural events, where it is usually called a spike raster, dot raster, or raster plot. However, it is useful in any situation where you wish to show the timing or position of multiple sets of discrete events, such as the arrival times of people to a business on each day of the month or the date of hurricanes each year of the last century. Parameters
positionsarray-like or list of array-like
A 1D array-like defines the positions of one sequence of events. Multiple groups of events may be passed as a list of array-likes. Each group can be styled independently by passing lists of values to lineoffsets, linelengths, linewidths, colors and linestyles. Note that positions can be a 2D array, but in practice different event groups usually have different counts so that one will use a list of different-length arrays rather than a 2D array.
orientation{'horizontal', 'vertical'}, default: 'horizontal'
The direction of the event sequence: 'horizontal': the events are arranged horizontally. The indicator lines are vertical. 'vertical': the events are arranged vertically. The indicator lines are horizontal.
lineoffsetsfloat or array-like, default: 1
The offset of the center of the lines from the origin, in the direction orthogonal to orientation. If positions is 2D, this can be a sequence with length matching the length of positions.
linelengthsfloat or array-like, default: 1
The total height of the lines (i.e. the lines stretches from lineoffset - linelength/2 to lineoffset + linelength/2). If positions is 2D, this can be a sequence with length matching the length of positions.
linewidthsfloat or array-like, default: rcParams["lines.linewidth"] (default: 1.5)
The line width(s) of the event lines, in points. If positions is 2D, this can be a sequence with length matching the length of positions.
colorscolor or list of colors, default: rcParams["lines.color"] (default: 'C0')
The color(s) of the event lines. If positions is 2D, this can be a sequence with length matching the length of positions.
linestylesstr or tuple or list of such values, default: 'solid'
Default is 'solid'. Valid strings are ['solid', 'dashed', 'dashdot', 'dotted', '-', '--', '-.', ':']. Dash tuples should be of the form: (offset, onoffseq),
where onoffseq is an even length tuple of on and off ink in points. If positions is 2D, this can be a sequence with length matching the length of positions.
dataindexable object, optional
If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception): positions, lineoffsets, linelengths, linewidths, colors, linestyles **kwargs
Other keyword arguments are line collection properties. See LineCollection for a list of the valid properties. Returns
list of EventCollection
The EventCollection that were added. Notes For linelengths, linewidths, colors, and linestyles, if only a single value is given, that value is applied to all lines. If an array-like is given, it must have the same length as positions, and each value will be applied to the corresponding row of the array. Examples (Source code, png, pdf)
|
matplotlib._as_gen.matplotlib.pyplot.eventplot
|
matplotlib.pyplot.figimage matplotlib.pyplot.figimage(X, xo=0, yo=0, alpha=None, norm=None, cmap=None, vmin=None, vmax=None, origin=None, resize=False, **kwargs)[source]
Add a non-resampled image to the figure. The image is attached to the lower or upper left corner depending on origin. Parameters
X
The image data. This is an array of one of the following shapes: MxN: luminance (grayscale) values MxNx3: RGB values MxNx4: RGBA values
xo, yoint
The x/y image offset in pixels.
alphaNone or float
The alpha blending value.
normmatplotlib.colors.Normalize
A Normalize instance to map the luminance to the interval [0, 1].
cmapstr or matplotlib.colors.Colormap, default: rcParams["image.cmap"] (default: 'viridis')
The colormap to use.
vmin, vmaxfloat
If norm is not given, these values set the data limits for the colormap.
origin{'upper', 'lower'}, default: rcParams["image.origin"] (default: 'upper')
Indicates where the [0, 0] index of the array is in the upper left or lower left corner of the axes.
resizebool
If True, resize the figure to match the given image size. Returns
matplotlib.image.FigureImage
Other Parameters
**kwargs
Additional kwargs are Artist kwargs passed on to FigureImage. Notes figimage complements the Axes image (imshow) which will be resampled to fit the current Axes. If you want a resampled image to fill the entire figure, you can define an Axes with extent [0, 0, 1, 1]. Examples f = plt.figure()
nx = int(f.get_figwidth() * f.dpi)
ny = int(f.get_figheight() * f.dpi)
data = np.random.random((ny, nx))
f.figimage(data)
plt.show()
|
matplotlib._as_gen.matplotlib.pyplot.figimage
|
matplotlib.pyplot.figlegend matplotlib.pyplot.figlegend(*args, **kwargs)[source]
Place a legend on the figure. Call signatures: figlegend()
figlegend(handles, labels)
figlegend(handles=handles)
figlegend(labels)
The call signatures correspond to the following different ways to use this method: 1. Automatic detection of elements to be shown in the legend The elements to be added to the legend are automatically determined, when you do not pass in any extra arguments. In this case, the labels are taken from the artist. You can specify them either at artist creation or by calling the set_label() method on the artist: ax.plot([1, 2, 3], label='Inline label')
fig.figlegend()
or: line, = ax.plot([1, 2, 3])
line.set_label('Label via method')
fig.figlegend()
Specific lines can be excluded from the automatic legend element selection by defining a label starting with an underscore. This is default for all artists, so calling Figure.legend without any arguments and without setting the labels manually will result in no legend being drawn. 2. Explicitly listing the artists and labels in the legend For full control of which artists have a legend entry, it is possible to pass an iterable of legend artists followed by an iterable of legend labels respectively: fig.figlegend([line1, line2, line3], ['label1', 'label2', 'label3'])
3. Explicitly listing the artists in the legend This is similar to 2, but the labels are taken from the artists' label properties. Example: line1, = ax1.plot([1, 2, 3], label='label1')
line2, = ax2.plot([1, 2, 3], label='label2')
fig.figlegend(handles=[line1, line2])
4. Labeling existing plot elements Discouraged This call signature is discouraged, because the relation between plot elements and labels is only implicit by their order and can easily be mixed up. To make a legend for all artists on all Axes, call this function with an iterable of strings, one for each legend item. For example: fig, (ax1, ax2) = plt.subplots(1, 2)
ax1.plot([1, 3, 5], color='blue')
ax2.plot([2, 4, 6], color='red')
fig.figlegend(['the blues', 'the reds'])
Parameters
handleslist of Artist, optional
A list of Artists (lines, patches) to be added to the legend. Use this together with labels, if you need full control on what is shown in the legend and the automatic mechanism described above is not sufficient. The length of handles and labels should be the same in this case. If they are not, they are truncated to the smaller length.
labelslist of str, optional
A list of labels to show next to the artists. Use this together with handles, if you need full control on what is shown in the legend and the automatic mechanism described above is not sufficient. Returns
Legend
Other Parameters
locstr or pair of floats, default: rcParams["legend.loc"] (default: 'best') ('best' for axes, 'upper right' for figures)
The location of the legend. The strings 'upper left', 'upper right', 'lower left', 'lower right' place the legend at the corresponding corner of the axes/figure. The strings 'upper center', 'lower center', 'center left', 'center right' place the legend at the center of the corresponding edge of the axes/figure. The string 'center' places the legend at the center of the axes/figure. The string 'best' places the legend at the location, among the nine locations defined so far, with the minimum overlap with other drawn artists. This option can be quite slow for plots with large amounts of data; your plotting speed may benefit from providing a specific location. The location can also be a 2-tuple giving the coordinates of the lower-left corner of the legend in axes coordinates (in which case bbox_to_anchor will be ignored). For back-compatibility, 'center right' (but no other location) can also be spelled 'right', and each "string" locations can also be given as a numeric value:
Location String Location Code
'best' 0
'upper right' 1
'upper left' 2
'lower left' 3
'lower right' 4
'right' 5
'center left' 6
'center right' 7
'lower center' 8
'upper center' 9
'center' 10
bbox_to_anchorBboxBase, 2-tuple, or 4-tuple of floats
Box that is used to position the legend in conjunction with loc. Defaults to axes.bbox (if called as a method to Axes.legend) or figure.bbox (if Figure.legend). This argument allows arbitrary placement of the legend. Bbox coordinates are interpreted in the coordinate system given by bbox_transform, with the default transform Axes or Figure coordinates, depending on which legend is called. If a 4-tuple or BboxBase is given, then it specifies the bbox (x, y, width, height) that the legend is placed in. To put the legend in the best location in the bottom right quadrant of the axes (or figure): loc='best', bbox_to_anchor=(0.5, 0., 0.5, 0.5)
A 2-tuple (x, y) places the corner of the legend specified by loc at x, y. For example, to put the legend's upper right-hand corner in the center of the axes (or figure) the following keywords can be used: loc='upper right', bbox_to_anchor=(0.5, 0.5)
ncolint, default: 1
The number of columns that the legend has.
propNone or matplotlib.font_manager.FontProperties or dict
The font properties of the legend. If None (default), the current matplotlib.rcParams will be used.
fontsizeint or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
The font size of the legend. If the value is numeric the size will be the absolute font size in points. String values are relative to the current default font size. This argument is only used if prop is not specified.
labelcolorstr or list, default: rcParams["legend.labelcolor"] (default: 'None')
The color of the text in the legend. Either a valid color string (for example, 'red'), or a list of color strings. The labelcolor can also be made to match the color of the line or marker using 'linecolor', 'markerfacecolor' (or 'mfc'), or 'markeredgecolor' (or 'mec'). Labelcolor can be set globally using rcParams["legend.labelcolor"] (default: 'None'). If None, use rcParams["text.color"] (default: 'black').
numpointsint, default: rcParams["legend.numpoints"] (default: 1)
The number of marker points in the legend when creating a legend entry for a Line2D (line).
scatterpointsint, default: rcParams["legend.scatterpoints"] (default: 1)
The number of marker points in the legend when creating a legend entry for a PathCollection (scatter plot).
scatteryoffsetsiterable of floats, default: [0.375, 0.5, 0.3125]
The vertical offset (relative to the font size) for the markers created for a scatter plot legend entry. 0.0 is at the base the legend text, and 1.0 is at the top. To draw all markers at the same height, set to [0.5].
markerscalefloat, default: rcParams["legend.markerscale"] (default: 1.0)
The relative size of legend markers compared with the originally drawn ones.
markerfirstbool, default: True
If True, legend marker is placed to the left of the legend label. If False, legend marker is placed to the right of the legend label.
frameonbool, default: rcParams["legend.frameon"] (default: True)
Whether the legend should be drawn on a patch (frame).
fancyboxbool, default: rcParams["legend.fancybox"] (default: True)
Whether round edges should be enabled around the FancyBboxPatch which makes up the legend's background.
shadowbool, default: rcParams["legend.shadow"] (default: False)
Whether to draw a shadow behind the legend.
framealphafloat, default: rcParams["legend.framealpha"] (default: 0.8)
The alpha transparency of the legend's background. If shadow is activated and framealpha is None, the default value is ignored.
facecolor"inherit" or color, default: rcParams["legend.facecolor"] (default: 'inherit')
The legend's background color. If "inherit", use rcParams["axes.facecolor"] (default: 'white').
edgecolor"inherit" or color, default: rcParams["legend.edgecolor"] (default: '0.8')
The legend's background patch edge color. If "inherit", use take rcParams["axes.edgecolor"] (default: 'black').
mode{"expand", None}
If mode is set to "expand" the legend will be horizontally expanded to fill the axes area (or bbox_to_anchor if defines the legend's size).
bbox_transformNone or matplotlib.transforms.Transform
The transform for the bounding box (bbox_to_anchor). For a value of None (default) the Axes' transAxes transform will be used.
titlestr or None
The legend's title. Default is no title (None).
title_fontpropertiesNone or matplotlib.font_manager.FontProperties or dict
The font properties of the legend's title. If None (default), the title_fontsize argument will be used if present; if title_fontsize is also None, the current rcParams["legend.title_fontsize"] (default: None) will be used.
title_fontsizeint or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}, default: rcParams["legend.title_fontsize"] (default: None)
The font size of the legend's title. Note: This cannot be combined with title_fontproperties. If you want to set the fontsize alongside other font properties, use the size parameter in title_fontproperties.
borderpadfloat, default: rcParams["legend.borderpad"] (default: 0.4)
The fractional whitespace inside the legend border, in font-size units.
labelspacingfloat, default: rcParams["legend.labelspacing"] (default: 0.5)
The vertical space between the legend entries, in font-size units.
handlelengthfloat, default: rcParams["legend.handlelength"] (default: 2.0)
The length of the legend handles, in font-size units.
handleheightfloat, default: rcParams["legend.handleheight"] (default: 0.7)
The height of the legend handles, in font-size units.
handletextpadfloat, default: rcParams["legend.handletextpad"] (default: 0.8)
The pad between the legend handle and text, in font-size units.
borderaxespadfloat, default: rcParams["legend.borderaxespad"] (default: 0.5)
The pad between the axes and legend border, in font-size units.
columnspacingfloat, default: rcParams["legend.columnspacing"] (default: 2.0)
The spacing between columns, in font-size units.
handler_mapdict or None
The custom dictionary mapping instances or types to a legend handler. This handler_map updates the default handler map found at matplotlib.legend.Legend.get_legend_handler_map. See also Axes.legend
Notes Some artists are not supported by this function. See Legend guide for details.
|
matplotlib._as_gen.matplotlib.pyplot.figlegend
|
matplotlib.pyplot.fignum_exists matplotlib.pyplot.fignum_exists(num)[source]
Return whether the figure with the given id exists.
|
matplotlib._as_gen.matplotlib.pyplot.fignum_exists
|
matplotlib.pyplot.figtext matplotlib.pyplot.figtext(x, y, s, fontdict=None, **kwargs)[source]
Add text to figure. Parameters
x, yfloat
The position to place the text. By default, this is in figure coordinates, floats in [0, 1]. The coordinate system can be changed using the transform keyword.
sstr
The text string.
fontdictdict, optional
A dictionary to override the default text properties. If not given, the defaults are determined by rcParams["font.*"]. Properties passed as kwargs override the corresponding ones given in fontdict. Returns
Text
Other Parameters
**kwargsText properties
Other miscellaneous text parameters.
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
backgroundcolor color
bbox dict with properties for patches.FancyBboxPatch
clip_box unknown
clip_on unknown
clip_path unknown
color or c color
figure Figure
fontfamily or family {FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
fontproperties or font or font_properties font_manager.FontProperties or str or pathlib.Path
fontsize or size float or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
fontstretch or stretch {a numeric value in range 0-1000, 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}
fontstyle or style {'normal', 'italic', 'oblique'}
fontvariant or variant {'normal', 'small-caps'}
fontweight or weight {a numeric value in range 0-1000, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
gid str
horizontalalignment or ha {'center', 'right', 'left'}
in_layout bool
label object
linespacing float (multiple of font size)
math_fontfamily str
multialignment or ma {'left', 'right', 'center'}
parse_math bool
path_effects AbstractPathEffect
picker None or bool or float or callable
position (float, float)
rasterized bool
rotation float or {'vertical', 'horizontal'}
rotation_mode {None, 'default', 'anchor'}
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
text object
transform Transform
transform_rotates_text bool
url str
usetex bool or None
verticalalignment or va {'center', 'top', 'bottom', 'baseline', 'center_baseline'}
visible bool
wrap bool
x float
y float
zorder float See also Axes.text
pyplot.text
Examples using matplotlib.pyplot.figtext
Fonts demo (object-oriented style)
Fonts demo (keyword arguments)
|
matplotlib._as_gen.matplotlib.pyplot.figtext
|
matplotlib.pyplot.figure matplotlib.pyplot.figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True, FigureClass=<class 'matplotlib.figure.Figure'>, clear=False, **kwargs)[source]
Create a new figure, or activate an existing figure. Parameters
numint or str or Figure, optional
A unique identifier for the figure. If a figure with that identifier already exists, this figure is made active and returned. An integer refers to the Figure.number attribute, a string refers to the figure label. If there is no figure with the identifier or num is not given, a new figure is created, made active and returned. If num is an int, it will be used for the Figure.number attribute, otherwise, an auto-generated integer value is used (starting at 1 and incremented for each new figure). If num is a string, the figure label and the window title is set to this value.
figsize(float, float), default: rcParams["figure.figsize"] (default: [6.4, 4.8])
Width, height in inches.
dpifloat, default: rcParams["figure.dpi"] (default: 100.0)
The resolution of the figure in dots-per-inch.
facecolorcolor, default: rcParams["figure.facecolor"] (default: 'white')
The background color.
edgecolorcolor, default: rcParams["figure.edgecolor"] (default: 'white')
The border color.
frameonbool, default: True
If False, suppress drawing the figure frame.
FigureClasssubclass of Figure
Optionally use a custom Figure instance.
clearbool, default: False
If True and the figure already exists, then it is cleared.
tight_layoutbool or dict, default: rcParams["figure.autolayout"] (default: False)
If False use subplotpars. If True adjust subplot parameters using tight_layout with default padding. When providing a dict containing the keys pad, w_pad, h_pad, and rect, the default tight_layout paddings will be overridden.
constrained_layoutbool, default: rcParams["figure.constrained_layout.use"] (default: False)
If True use constrained layout to adjust positioning of plot elements. Like tight_layout, but designed to be more flexible. See Constrained Layout Guide for examples. (Note: does not work with add_subplot or subplot2grid.) **kwargs : optional
See Figure for other possible arguments. Returns
Figure
The Figure instance returned will also be passed to new_figure_manager in the backends, which allows to hook custom Figure classes into the pyplot interface. Additional kwargs will be passed to the Figure init function. Notes If you are creating many figures, make sure you explicitly call pyplot.close on the figures you are not using, because this will enable pyplot to properly clean up the memory. rcParams defines the default values, which can be modified in the matplotlibrc file.
Examples using matplotlib.pyplot.figure
Curve with error band
Errorbar limit selection
EventCollection Demo
Filled polygon
Linestyles
Markevery Demo
prop_cycle property markevery in rcParams
Psd Demo
Scatter plot with histograms
Barcode
Figimage Demo
Layer Images
Streamplot
Aligning Labels
Axes Zoom Effect
Custom Figure subclasses
Resizing axes with constrained layout
Resizing axes with tight layout
Geographic Projections
Using Gridspec to make multi-column/row subplot layouts
Nested Gridspecs
Managing multiple figures in pyplot
Figure subfigures
Creating multiple subplots using plt.subplots
Polar Legend
Scatter plot on polar axis
Arrow Demo
Auto-wrapping text
Text Rotation Mode
The difference between \dfrac and \frac
Annotation arrow style reference
Convert texts to images
Mathtext Examples
Rainbow text
STIX Fonts
Unicode minus
Usetex Baseline Test
Usetex Fonteffects
Annotation Polar
Fig Axes Customize Simple
Simple axes labels
Adding lines to figures
Pyplot Two Subplots
Text Commands
Text Layout
Drawing fancy boxes
Hatch demo
Axes Divider
Demo Axes Grid
Axes Grid2
Showing RGB channels using RGBAxes
Per-row or per-column colorbars
Axes with a fixed physical size
Setting a fixed aspect on ImageGrid cells
Inset Locator Demo
Make Room For Ylabel Using Axesgrid
Parasite Simple2
Simple Axes Divider 1
Simple Axes Divider 3
Simple ImageGrid
Simple ImageGrid 2
Axis Direction
axis_direction demo
Axis line styles
Curvilinear grid demo
Demo CurveLinear Grid2
mpl_toolkits.axisartist.floating_axes features
floating_axis demo
Parasite Axes demo
Ticklabel alignment
Ticklabel direction
Simple Axis Direction01
Simple Axis Direction03
Simple Axis Pad
Custom spines with axisartist
Simple Axisline
Simple Axisline3
Anatomy of a figure
Firefox
Shaded & power normalized rendering
XKCD
The double pendulum problem
Frame grabbing
Rain simulation
Animated 3D random walk
MATPLOTLIB UNCHAINED
Close Event
Interactive functions
Hyperlinks
Matplotlib logo
Multipage PDF
SVG Filter Line
SVG Filter Pie
transforms.offset_copy
Zorder Demo
Plot 2D data on 3D plot
Demo of 3D bar charts
Create 2D bar graphs in different planes
3D box surface plot
Demonstrates plotting contour (level) curves in 3D
Demonstrates plotting contour (level) curves in 3D using the extend3d option
Projecting contour profiles onto a graph
Filled contours
Projecting filled contour onto a graph
3D errorbars
Create 3D histogram of 2D data
Parametric Curve
Lorenz Attractor
2D and 3D Axes in same Figure
Automatic Text Offsetting
Draw flat objects in 3D plot
Generate polygons to fill under 3D line graph
3D quiver plot
Rotating a 3D plot
3D scatterplot
3D plots as subplots
3D surface (solid color)
3D surface (checkerboard)
3D surface with polar coordinates
Text annotations in 3D
Triangular 3D contour plot
Triangular 3D filled contour plot
Triangular 3D surfaces
More triangular 3D surfaces
3D voxel / volumetric plot
3D voxel plot of the numpy logo
3D voxel / volumetric plot with rgb colors
3D voxel / volumetric plot with cylindrical coordinates
3D wireframe plot
Rotating 3D wireframe plot
MRI With EEG
The Sankey class
Long chain of connections using Sankey
Rankine power cycle
SkewT-logP diagram: using transforms and custom projections
Spine Placement
Ellipse With Units
SVG Histogram
Tool Manager
subplot2grid demo
GridSpec demo
Nested GridSpecs
Simple Legend01
Menu
Rectangle and ellipse selectors
Basic Usage
Pyplot tutorial
Image tutorial
Artist tutorial
Constrained Layout Guide
Tight Layout guide
Arranging multiple Axes in a Figure
origin and extent in imshow
Path effects guide
Transformations Tutorial
Specifying Colors
Complex and semantic figure composition
Text in Matplotlib Plots
Text properties and layout
|
matplotlib._as_gen.matplotlib.pyplot.figure
|
matplotlib.pyplot.fill matplotlib.pyplot.fill(*args, data=None, **kwargs)[source]
Plot filled polygons. Parameters
*argssequence of x, y, [color]
Each polygon is defined by the lists of x and y positions of its nodes, optionally followed by a color specifier. See matplotlib.colors for supported color specifiers. The standard color cycle is used for polygons without a color specifier. You can plot multiple polygons by providing multiple x, y, [color] groups. For example, each of the following is legal: ax.fill(x, y) # a polygon with default color
ax.fill(x, y, "b") # a blue polygon
ax.fill(x, y, x2, y2) # two polygons
ax.fill(x, y, "b", x2, y2, "r") # a blue and a red polygon
dataindexable object, optional
An object with labelled data. If given, provide the label names to plot in x and y, e.g.: ax.fill("time", "signal",
data={"time": [0, 1, 2], "signal": [0, 1, 0]})
Returns
list of Polygon
Other Parameters
**kwargsPolygon properties
Notes Use fill_between() if you would like to fill the region between two curves.
Examples using matplotlib.pyplot.fill
Filled polygon
Interactive functions
Fill Spiral
|
matplotlib._as_gen.matplotlib.pyplot.fill
|
matplotlib.pyplot.fill_between matplotlib.pyplot.fill_between(x, y1, y2=0, where=None, interpolate=False, step=None, *, data=None, **kwargs)[source]
Fill the area between two horizontal curves. The curves are defined by the points (x, y1) and (x, y2). This creates one or multiple polygons describing the filled area. You may exclude some horizontal 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 x. Parameters
xarray (length N)
The x coordinates of the nodes defining the curves.
y1array (length N) or scalar
The y coordinates of the nodes defining the first curve.
y2array (length N) or scalar, default: 0
The y coordinates of the nodes defining the second curve.
wherearray of bool (length N), optional
Define where to exclude some horizontal regions from being filled. The filled regions are defined by the coordinates x[where]. More precisely, fill between x[i] and x[i+1] if where[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 y1 > y2 or similar. By default, the nodes of the polygon defining the filled region will only be placed at the positions in the x array. Such a polygon cannot describe the above semantics close to the intersection. The x-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 x. The value determines where the step will occur: 'pre': The y value is continued constantly to the left from every x position, i.e. the interval (x[i-1], x[i]] has the value y[i]. 'post': The y value is continued constantly to the right from every x position, i.e. the interval [x[i], x[i+1]) has the value y[i]. 'mid': Steps occur half-way between the x positions. Returns
PolyCollection
A PolyCollection containing the plotted polygons. Other Parameters
dataindexable object, optional
If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception): x, y1, y2, where **kwargs
All other keyword arguments are passed on to PolyCollection. They control the Polygon properties:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
edgecolor or ec or edgecolors color or list of colors or 'face'
facecolor or facecolors or fc color or list of colors
figure Figure
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or dashes or linestyles or ls str or tuple or list thereof
linewidth or linewidths or lw float or list of floats
norm Normalize or None
offset_transform Transform
offsets (N, 2) or (2,) array-like
path_effects AbstractPathEffect
paths list of array-like
picker None or bool or float or callable
pickradius float
rasterized bool
sizes ndarray or None
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
urls list of str or None
verts list of array-like
verts_and_codes unknown
visible bool
zorder float See also fill_between
Fill between two sets of y-values. fill_betweenx
Fill between two sets of x-values.
|
matplotlib._as_gen.matplotlib.pyplot.fill_between
|
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 between y[i] and y[i+1] if where[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 y value is continued constantly to the left from every x position, i.e. the interval (x[i-1], x[i]] has the value y[i]. 'post': The y value is continued constantly to the right from every x position, i.e. the interval [x[i], x[i+1]) has the value y[i]. 'mid': Steps occur half-way between the x positions. Returns
PolyCollection
A PolyCollection containing the plotted polygons. Other Parameters
dataindexable object, optional
If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception): y, x1, x2, where **kwargs
All other keyword arguments are passed on to PolyCollection. They control the Polygon properties:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
edgecolor or ec or edgecolors color or list of colors or 'face'
facecolor or facecolors or fc color or list of colors
figure Figure
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or dashes or linestyles or ls str or tuple or list thereof
linewidth or linewidths or lw float or list of floats
norm Normalize or None
offset_transform Transform
offsets (N, 2) or (2,) array-like
path_effects AbstractPathEffect
paths list of array-like
picker None or bool or float or callable
pickradius float
rasterized bool
sizes ndarray or None
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
urls list of str or None
verts list of array-like
verts_and_codes unknown
visible bool
zorder float See also fill_between
Fill between two sets of y-values. fill_betweenx
Fill between two sets of x-values.
|
matplotlib._as_gen.matplotlib.pyplot.fill_betweenx
|
matplotlib.pyplot.findobj matplotlib.pyplot.findobj(o=None, match=None, include_self=True)[source]
Find artist objects. Recursively find all Artist instances contained in the artist. Parameters
match
A filter criterion for the matches. This can be
None: Return all objects contained in artist. A function with signature def match(artist: Artist) -> bool. The result will only contain artists for which the function returns True. A class instance: e.g., Line2D. The result will only contain artists of this class or its subclasses (isinstance check).
include_selfbool
Include self in the list to be checked for a match. Returns
list of Artist
|
matplotlib._as_gen.matplotlib.pyplot.findobj
|
matplotlib.pyplot.flag matplotlib.pyplot.flag()[source]
Set the colormap to 'flag'. This changes the default colormap as well as the colormap of the current image if there is one. See help(colormaps) for more information.
|
matplotlib._as_gen.matplotlib.pyplot.flag
|
matplotlib.pyplot.gca matplotlib.pyplot.gca(**kwargs)[source]
Get the current Axes. If there is currently no Axes on this Figure, a new one is created using Figure.add_subplot. (To test whether there is currently an Axes on a Figure, check whether figure.axes is empty. To test whether there is currently a Figure on the pyplot figure stack, check whether pyplot.get_fignums() is empty.) The following kwargs are supported for ensuring the returned Axes adheres to the given projection etc., and for Axes creation if the active Axes does not exist:
Property Description
adjustable {'box', 'datalim'}
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
anchor (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}
animated bool
aspect {'auto', 'equal'} or float
autoscale_on bool
autoscalex_on bool
autoscaley_on bool
axes_locator Callable[[Axes, Renderer], Bbox]
axisbelow bool or 'line'
box_aspect float or None
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
facecolor or fc color
figure Figure
frame_on bool
gid str
in_layout bool
label object
navigate bool
navigate_mode unknown
path_effects AbstractPathEffect
picker None or bool or float or callable
position [left, bottom, width, height] or Bbox
prop_cycle unknown
rasterization_zorder float or None
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
title str
transform Transform
url str
visible bool
xbound unknown
xlabel str
xlim (bottom: float, top: float)
xmargin float greater than -0.5
xscale {"linear", "log", "symlog", "logit", ...} or ScaleBase
xticklabels unknown
xticks unknown
ybound unknown
ylabel str
ylim (bottom: float, top: float)
ymargin float greater than -0.5
yscale {"linear", "log", "symlog", "logit", ...} or ScaleBase
yticklabels unknown
yticks unknown
zorder float
Examples using matplotlib.pyplot.gca
Creating annotated heatmaps
Managing multiple figures in pyplot
Scale invariant angle label
Rainbow text
Infinite lines
Set and get properties
Hinton diagrams
Tight Layout guide
|
matplotlib._as_gen.matplotlib.pyplot.gca
|
matplotlib.pyplot.gcf matplotlib.pyplot.gcf()[source]
Get the current figure. If there is currently no figure on the pyplot figure stack, a new one is created using figure(). (To test whether there is currently a figure on the pyplot figure stack, check whether get_fignums() is empty.)
|
matplotlib._as_gen.matplotlib.pyplot.gcf
|
matplotlib.pyplot.gci matplotlib.pyplot.gci()[source]
Get the current colorable artist. Specifically, returns the current ScalarMappable instance (Image created by imshow or figimage, Collection created by pcolor or scatter, etc.), or None if no such instance has been defined. The current image is an attribute of the current Axes, or the nearest earlier Axes in the current figure that contains an image. Notes Historically, the only colorable artists were images; hence the name gci (get current image).
|
matplotlib._as_gen.matplotlib.pyplot.gci
|
matplotlib.pyplot.get matplotlib.pyplot.get(obj, *args, **kwargs)[source]
Return the value of an Artist's property, or print all of them. Parameters
objArtist
The queried artist; e.g., a Line2D, a Text, or an Axes.
propertystr or None, default: None
If property is 'somename', this function returns obj.get_somename(). If it's None (or unset), it prints all gettable properties from obj. Many properties have aliases for shorter typing, e.g. 'lw' is an alias for 'linewidth'. In the output, aliases and full property names will be listed as: property or alias = value e.g.: linewidth or lw = 2 See also setp
|
matplotlib._as_gen.matplotlib.pyplot.get
|
matplotlib.pyplot.get_current_fig_manager matplotlib.pyplot.get_current_fig_manager()[source]
Return the figure manager of the current figure. The figure manager is a container for the actual backend-depended window that displays the figure on screen. If no current figure exists, a new one is created, and its figure manager is returned. Returns
FigureManagerBase or backend-dependent subclass thereof
|
matplotlib._as_gen.matplotlib.pyplot.get_current_fig_manager
|
matplotlib.pyplot.get_figlabels matplotlib.pyplot.get_figlabels()[source]
Return a list of existing figure labels.
|
matplotlib._as_gen.matplotlib.pyplot.get_figlabels
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.