doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
matplotlib.artist.Artist.add_callback Artist.add_callback(func)[source] Add a callback function that will be called whenever one of the Artist's properties changes. Parameters funccallable The callback function. It must have the signature: def func(artist: Artist) -> Any where artist is the calling Artist. Return values may exist but are ignored. Returns int The observer id associated with the callback. This id can be used for removing the callback with remove_callback later. See also remove_callback
matplotlib._as_gen.matplotlib.artist.artist.add_callback
matplotlib.artist.Artist.axes propertyArtist.axes The Axes instance the artist resides in, or None.
matplotlib._as_gen.matplotlib.artist.artist.axes
matplotlib.artist.Artist.contains Artist.contains(mouseevent)[source] Test whether the artist contains the mouse event. Parameters mouseeventmatplotlib.backend_bases.MouseEvent Returns containsbool Whether any values are within the radius. detailsdict An artist-specific dictionary of details of the event context, such as which points are contained in the pick radius. See the individual Artist subclasses for details.
matplotlib._as_gen.matplotlib.artist.artist.contains
matplotlib.artist.Artist.convert_xunits Artist.convert_xunits(x)[source] Convert x using the unit type of the xaxis. If the artist is not in contained in an Axes or if the xaxis does not have units, x itself is returned.
matplotlib._as_gen.matplotlib.artist.artist.convert_xunits
matplotlib.artist.Artist.convert_yunits Artist.convert_yunits(y)[source] Convert y using the unit type of the yaxis. If the artist is not in contained in an Axes or if the yaxis does not have units, y itself is returned.
matplotlib._as_gen.matplotlib.artist.artist.convert_yunits
matplotlib.artist.Artist.draw Artist.draw(renderer)[source] Draw the Artist (and its children) using the given renderer. This has no effect if the artist is not visible (Artist.get_visible returns False). Parameters rendererRendererBase subclass. Notes This method is overridden in the Artist subclasses.
matplotlib._as_gen.matplotlib.artist.artist.draw
matplotlib.artist.Artist.findobj Artist.findobj(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.artist.artist.findobj
matplotlib.artist.Artist.format_cursor_data Artist.format_cursor_data(data)[source] Return a string representation of data. Note This method is intended to be overridden by artist subclasses. As an end-user of Matplotlib you will most likely not call this method yourself. The default implementation converts ints and floats and arrays of ints and floats into a comma-separated string enclosed in square brackets, unless the artist has an associated colorbar, in which case scalar values are formatted using the colorbar's formatter. See also get_cursor_data
matplotlib._as_gen.matplotlib.artist.artist.format_cursor_data
matplotlib.artist.Artist.get_agg_filter Artist.get_agg_filter()[source] Return filter function to be used for agg filter.
matplotlib._as_gen.matplotlib.artist.artist.get_agg_filter
matplotlib.artist.Artist.get_alpha Artist.get_alpha()[source] Return the alpha value used for blending - not supported on all backends.
matplotlib._as_gen.matplotlib.artist.artist.get_alpha
matplotlib.artist.Artist.get_animated Artist.get_animated()[source] Return whether the artist is animated.
matplotlib._as_gen.matplotlib.artist.artist.get_animated
matplotlib.artist.Artist.get_children Artist.get_children()[source] Return a list of the child Artists of this Artist.
matplotlib._as_gen.matplotlib.artist.artist.get_children
matplotlib.artist.Artist.get_clip_box Artist.get_clip_box()[source] Return the clipbox.
matplotlib._as_gen.matplotlib.artist.artist.get_clip_box
matplotlib.artist.Artist.get_clip_on Artist.get_clip_on()[source] Return whether the artist uses clipping.
matplotlib._as_gen.matplotlib.artist.artist.get_clip_on
matplotlib.artist.Artist.get_clip_path Artist.get_clip_path()[source] Return the clip path.
matplotlib._as_gen.matplotlib.artist.artist.get_clip_path
matplotlib.artist.Artist.get_cursor_data Artist.get_cursor_data(event)[source] Return the cursor data for a given event. Note This method is intended to be overridden by artist subclasses. As an end-user of Matplotlib you will most likely not call this method yourself. Cursor data can be used by Artists to provide additional context information for a given event. The default implementation just returns None. Subclasses can override the method and return arbitrary data. However, when doing so, they must ensure that format_cursor_data can convert the data to a string representation. The only current use case is displaying the z-value of an AxesImage in the status bar of a plot window, while moving the mouse. Parameters eventmatplotlib.backend_bases.MouseEvent See also format_cursor_data
matplotlib._as_gen.matplotlib.artist.artist.get_cursor_data
matplotlib.artist.Artist.get_figure Artist.get_figure()[source] Return the Figure instance the artist belongs to.
matplotlib._as_gen.matplotlib.artist.artist.get_figure
matplotlib.artist.Artist.get_gid Artist.get_gid()[source] Return the group id.
matplotlib._as_gen.matplotlib.artist.artist.get_gid
matplotlib.artist.Artist.get_in_layout Artist.get_in_layout()[source] Return boolean flag, True if artist is included in layout calculations. E.g. Constrained Layout Guide, Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight').
matplotlib._as_gen.matplotlib.artist.artist.get_in_layout
matplotlib.artist.Artist.get_label Artist.get_label()[source] Return the label used for this artist in the legend.
matplotlib._as_gen.matplotlib.artist.artist.get_label
matplotlib.artist.Artist.get_path_effects Artist.get_path_effects()[source]
matplotlib._as_gen.matplotlib.artist.artist.get_path_effects
matplotlib.artist.Artist.get_picker Artist.get_picker()[source] Return the picking behavior of the artist. The possible values are described in set_picker. See also set_picker, pickable, pick
matplotlib._as_gen.matplotlib.artist.artist.get_picker
matplotlib.artist.Artist.get_rasterized Artist.get_rasterized()[source] Return whether the artist is to be rasterized.
matplotlib._as_gen.matplotlib.artist.artist.get_rasterized
matplotlib.artist.Artist.get_sketch_params Artist.get_sketch_params()[source] Return the sketch parameters for the artist. Returns tuple or None A 3-tuple with the following elements: scale: The amplitude of the wiggle perpendicular to the source line. length: The length of the wiggle along the line. randomness: The scale factor by which the length is shrunken or expanded. Returns None if no sketch parameters were set.
matplotlib._as_gen.matplotlib.artist.artist.get_sketch_params
matplotlib.artist.Artist.get_snap Artist.get_snap()[source] Return the snap setting. See set_snap for details.
matplotlib._as_gen.matplotlib.artist.artist.get_snap
matplotlib.artist.Artist.get_transform Artist.get_transform()[source] Return the Transform instance used by this artist.
matplotlib._as_gen.matplotlib.artist.artist.get_transform
matplotlib.artist.Artist.get_transformed_clip_path_and_affine Artist.get_transformed_clip_path_and_affine()[source] Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
matplotlib._as_gen.matplotlib.artist.artist.get_transformed_clip_path_and_affine
matplotlib.artist.Artist.get_url Artist.get_url()[source] Return the url.
matplotlib._as_gen.matplotlib.artist.artist.get_url
matplotlib.artist.Artist.get_visible Artist.get_visible()[source] Return the visibility.
matplotlib._as_gen.matplotlib.artist.artist.get_visible
matplotlib.artist.Artist.get_window_extent Artist.get_window_extent(renderer)[source] Get the artist's bounding box in display space. The bounding box' width and height are nonnegative. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0. Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
matplotlib._as_gen.matplotlib.artist.artist.get_window_extent
matplotlib.artist.Artist.get_zorder Artist.get_zorder()[source] Return the artist's zorder.
matplotlib._as_gen.matplotlib.artist.artist.get_zorder
matplotlib.artist.Artist.have_units Artist.have_units()[source] Return whether units are set on any axis.
matplotlib._as_gen.matplotlib.artist.artist.have_units
matplotlib.artist.Artist.is_transform_set Artist.is_transform_set()[source] Return whether the Artist has an explicitly set transform. This is True after set_transform has been called.
matplotlib._as_gen.matplotlib.artist.artist.is_transform_set
matplotlib.artist.Artist.mouseover propertyArtist.mouseover If this property is set to True, the artist will be queried for custom context information when the mouse cursor moves over it. See also get_cursor_data(), ToolCursorPosition and NavigationToolbar2.
matplotlib._as_gen.matplotlib.artist.artist.mouseover
matplotlib.artist.Artist.pchanged Artist.pchanged()[source] Call all of the registered callbacks. This function is triggered internally when a property is changed. See also add_callback remove_callback
matplotlib._as_gen.matplotlib.artist.artist.pchanged
matplotlib.artist.Artist.pick Artist.pick(mouseevent)[source] Process a pick event. Each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set. See also set_picker, get_picker, pickable
matplotlib._as_gen.matplotlib.artist.artist.pick
matplotlib.artist.Artist.pickable Artist.pickable()[source] Return whether the artist is pickable. See also set_picker, get_picker, pick
matplotlib._as_gen.matplotlib.artist.artist.pickable
matplotlib.artist.Artist.properties Artist.properties()[source] Return a dictionary of all the properties of the artist.
matplotlib._as_gen.matplotlib.artist.artist.properties
matplotlib.artist.Artist.remove Artist.remove()[source] Remove the artist from the figure if possible. The effect will not be visible until the figure is redrawn, e.g., with FigureCanvasBase.draw_idle. Call relim to update the axes limits if desired. Note: relim will not see collections even if the collection was added to the axes with autolim = True. Note: there is no support for removing the artist's legend entry.
matplotlib._as_gen.matplotlib.artist.artist.remove
matplotlib.artist.Artist.remove_callback Artist.remove_callback(oid)[source] Remove a callback based on its observer id. See also add_callback
matplotlib._as_gen.matplotlib.artist.artist.remove_callback
matplotlib.artist.Artist.set Artist.set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<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 object 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._as_gen.matplotlib.artist.artist.set
matplotlib.artist.Artist.set_agg_filter Artist.set_agg_filter(filter_func)[source] Set the agg filter. Parameters filter_funccallable A filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array.
matplotlib._as_gen.matplotlib.artist.artist.set_agg_filter
matplotlib.artist.Artist.set_alpha Artist.set_alpha(alpha)[source] Set the alpha value used for blending - not supported on all backends. Parameters alphascalar or None alpha must be within the 0-1 range, inclusive.
matplotlib._as_gen.matplotlib.artist.artist.set_alpha
matplotlib.artist.Artist.set_animated Artist.set_animated(b)[source] Set whether the artist is intended to be used in an animation. If True, the artist is excluded from regular drawing of the figure. You have to call Figure.draw_artist / Axes.draw_artist explicitly on the artist. This appoach is used to speed up animations using blitting. See also matplotlib.animation and Faster rendering by using blitting. Parameters bbool
matplotlib._as_gen.matplotlib.artist.artist.set_animated
matplotlib.artist.Artist.set_clip_box Artist.set_clip_box(clipbox)[source] Set the artist's clip Bbox. Parameters clipboxBbox
matplotlib._as_gen.matplotlib.artist.artist.set_clip_box
matplotlib.artist.Artist.set_clip_on Artist.set_clip_on(b)[source] Set whether the artist uses clipping. When False artists will be visible outside of the axes which can lead to unexpected results. Parameters bbool
matplotlib._as_gen.matplotlib.artist.artist.set_clip_on
matplotlib.artist.Artist.set_clip_path Artist.set_clip_path(path, transform=None)[source] Set the artist's clip path. Parameters pathPatch or Path or TransformedPath or None The clip path. If given a Path, transform must be provided as well. If None, a previously set clip path is removed. transformTransform, optional Only used if path is a Path, in which case the given Path is converted to a TransformedPath using transform. Notes For efficiency, if path is a Rectangle this method will set the clipping box to the corresponding rectangle and set the clipping path to None. For technical reasons (support of set), a tuple (path, transform) is also accepted as a single positional parameter.
matplotlib._as_gen.matplotlib.artist.artist.set_clip_path
matplotlib.artist.Artist.set_figure Artist.set_figure(fig)[source] Set the Figure instance the artist belongs to. Parameters figFigure
matplotlib._as_gen.matplotlib.artist.artist.set_figure
matplotlib.artist.Artist.set_gid Artist.set_gid(gid)[source] Set the (group) id for the artist. Parameters gidstr
matplotlib._as_gen.matplotlib.artist.artist.set_gid
matplotlib.artist.Artist.set_in_layout Artist.set_in_layout(in_layout)[source] Set if artist is to be included in layout calculations, E.g. Constrained Layout Guide, Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight'). Parameters in_layoutbool
matplotlib._as_gen.matplotlib.artist.artist.set_in_layout
matplotlib.artist.Artist.set_label Artist.set_label(s)[source] Set a label that will be displayed in the legend. Parameters sobject s will be converted to a string by calling str.
matplotlib._as_gen.matplotlib.artist.artist.set_label
matplotlib.artist.Artist.set_path_effects Artist.set_path_effects(path_effects)[source] Set the path effects. Parameters path_effectsAbstractPathEffect
matplotlib._as_gen.matplotlib.artist.artist.set_path_effects
matplotlib.artist.Artist.set_picker Artist.set_picker(picker)[source] Define the picking behavior of the artist. Parameters pickerNone or bool or float or callable This can be one of the following: None: Picking is disabled for this artist (default). A boolean: If True then picking will be enabled and the artist will fire a pick event if the mouse event is over the artist. A float: If picker is a number it is interpreted as an epsilon tolerance in points and the artist will fire off an event if its data is within epsilon of the mouse event. For some artists like lines and patch collections, the artist may provide additional data to the pick event that is generated, e.g., the indices of the data within epsilon of the pick event A function: If picker is callable, it is a user supplied function which determines whether the artist is hit by the mouse event: hit, props = picker(artist, mouseevent) to determine the hit test. if the mouse event is over the artist, return hit=True and props is a dictionary of properties you want added to the PickEvent attributes.
matplotlib._as_gen.matplotlib.artist.artist.set_picker
matplotlib.artist.Artist.set_rasterized Artist.set_rasterized(rasterized)[source] Force rasterized (bitmap) drawing for vector graphics output. Rasterized drawing is not supported by all artists. If you try to enable this on an artist that does not support it, the command has no effect and a warning will be issued. This setting is ignored for pixel-based output. See also Rasterization for vector graphics. Parameters rasterizedbool
matplotlib._as_gen.matplotlib.artist.artist.set_rasterized
matplotlib.artist.Artist.set_sketch_params Artist.set_sketch_params(scale=None, length=None, randomness=None)[source] Set the sketch parameters. Parameters scalefloat, optional The amplitude of the wiggle perpendicular to the source line, in pixels. If scale is None, or not provided, no sketch filter will be provided. lengthfloat, optional The length of the wiggle along the line, in pixels (default 128.0) randomnessfloat, optional The scale factor by which the length is shrunken or expanded (default 16.0) The PGF backend uses this argument as an RNG seed and not as described above. Using the same seed yields the same random shape.
matplotlib._as_gen.matplotlib.artist.artist.set_sketch_params
matplotlib.artist.Artist.set_snap Artist.set_snap(snap)[source] Set the snapping behavior. Snapping aligns positions with the pixel grid, which results in clearer images. For example, if a black line of 1px width was defined at a position in between two pixels, the resulting image would contain the interpolated value of that line in the pixel grid, which would be a grey value on both adjacent pixel positions. In contrast, snapping will move the line to the nearest integer pixel value, so that the resulting image will really contain a 1px wide black line. Snapping is currently only supported by the Agg and MacOSX backends. Parameters snapbool or None Possible values: True: Snap vertices to the nearest pixel center. False: Do not modify vertex positions. None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center.
matplotlib._as_gen.matplotlib.artist.artist.set_snap
matplotlib.artist.Artist.set_transform Artist.set_transform(t)[source] Set the artist transform. Parameters tTransform
matplotlib._as_gen.matplotlib.artist.artist.set_transform
matplotlib.artist.Artist.set_url Artist.set_url(url)[source] Set the url for the artist. Parameters urlstr
matplotlib._as_gen.matplotlib.artist.artist.set_url
matplotlib.artist.Artist.set_visible Artist.set_visible(b)[source] Set the artist's visibility. Parameters bbool
matplotlib._as_gen.matplotlib.artist.artist.set_visible
matplotlib.artist.Artist.set_zorder Artist.set_zorder(level)[source] Set the zorder for the artist. Artists with lower zorder values are drawn first. Parameters levelfloat
matplotlib._as_gen.matplotlib.artist.artist.set_zorder
matplotlib.artist.Artist.stale propertyArtist.stale Whether the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
matplotlib._as_gen.matplotlib.artist.artist.stale
matplotlib.artist.Artist.sticky_edges propertyArtist.sticky_edges x and y sticky edge lists for autoscaling. When performing autoscaling, if a data limit coincides with a value in the corresponding sticky_edges list, then no margin will be added--the view limit "sticks" to the edge. A typical use case is histograms, where one usually expects no margin on the bottom edge (0) of the histogram. Moreover, margin expansion "bumps" against sticky edges and cannot cross them. For example, if the upper data limit is 1.0, the upper view limit computed by simple margin application is 1.2, but there is a sticky edge at 1.1, then the actual upper view limit will be 1.1. This attribute cannot be assigned to; however, the x and y lists can be modified in place as needed. Examples >>> artist.sticky_edges.x[:] = (xmin, xmax) >>> artist.sticky_edges.y[:] = (ymin, ymax)
matplotlib._as_gen.matplotlib.artist.artist.sticky_edges
matplotlib.artist.Artist.update Artist.update(props)[source] Update this artist's properties from the dict props. Parameters propsdict
matplotlib._as_gen.matplotlib.artist.artist.update
matplotlib.artist.Artist.update_from Artist.update_from(other)[source] Copy properties from other to self.
matplotlib._as_gen.matplotlib.artist.artist.update_from
matplotlib.artist.Artist.zorder Artist.zorder=0
matplotlib._as_gen.matplotlib.artist.artist.zorder
matplotlib.artist.ArtistInspector classmatplotlib.artist.ArtistInspector(o)[source] A helper class to inspect an Artist and return information about its settable properties and their current values. Initialize the artist inspector with an Artist or an iterable of Artists. If an iterable is used, we assume it is a homogeneous sequence (all Artists are of the same type) and it is your responsibility to make sure this is so. __init__(o)[source] Initialize the artist inspector with an Artist or an iterable of Artists. If an iterable is used, we assume it is a homogeneous sequence (all Artists are of the same type) and it is your responsibility to make sure this is so. Methods __init__(o) Initialize the artist inspector with an Artist or an iterable of Artists. aliased_name(s) Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME'. aliased_name_rest(s, target) Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME', formatted for reST. get_aliases() Get a dict mapping property fullnames to sets of aliases for each alias in the ArtistInspector. get_setters() Get the attribute strings with setters for object. get_valid_values(attr) Get the legal arguments for the setter associated with attr. is_alias(o) Return whether method object o is an alias for another method. pprint_getters() Return the getters and actual values as list of strings. pprint_setters([prop, leadingspace]) If prop is None, return a list of strings of all settable properties and their valid values. pprint_setters_rest([prop, leadingspace]) If prop is None, return a list of reST-formatted strings of all settable properties and their valid values. properties() Return a dictionary mapping property name -> value. aliased_name(s)[source] Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME'. e.g., for the line markerfacecolor property, which has an alias, return 'markerfacecolor or mfc' and for the transform property, which does not, return 'transform'. aliased_name_rest(s, target)[source] Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME', formatted for reST. e.g., for the line markerfacecolor property, which has an alias, return 'markerfacecolor or mfc' and for the transform property, which does not, return 'transform'. get_aliases()[source] Get a dict mapping property fullnames to sets of aliases for each alias in the ArtistInspector. e.g., for lines: {'markerfacecolor': {'mfc'}, 'linewidth' : {'lw'}, } get_setters()[source] Get the attribute strings with setters for object. For example, for a line, return ['markerfacecolor', 'linewidth', ....]. get_valid_values(attr)[source] Get the legal arguments for the setter associated with attr. This is done by querying the docstring of the setter for a line that begins with "ACCEPTS:" or ".. ACCEPTS:", and then by looking for a numpydoc-style documentation for the setter's first argument. is_alias(o)[source] Return whether method object o is an alias for another method. pprint_getters()[source] Return the getters and actual values as list of strings. pprint_setters(prop=None, leadingspace=2)[source] If prop is None, return a list of strings of all settable properties and their valid values. If prop is not None, it is a valid property name and that property will be returned as a string of property : valid values. pprint_setters_rest(prop=None, leadingspace=4)[source] If prop is None, return a list of reST-formatted strings of all settable properties and their valid values. If prop is not None, it is a valid property name and that property will be returned as a string of "property : valid" values. properties()[source] Return a dictionary mapping property name -> value.
matplotlib._as_gen.matplotlib.artist.artistinspector
__init__(o)[source] Initialize the artist inspector with an Artist or an iterable of Artists. If an iterable is used, we assume it is a homogeneous sequence (all Artists are of the same type) and it is your responsibility to make sure this is so.
matplotlib._as_gen.matplotlib.artist.artistinspector#matplotlib.artist.ArtistInspector.__init__
aliased_name(s)[source] Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME'. e.g., for the line markerfacecolor property, which has an alias, return 'markerfacecolor or mfc' and for the transform property, which does not, return 'transform'.
matplotlib._as_gen.matplotlib.artist.artistinspector#matplotlib.artist.ArtistInspector.aliased_name
aliased_name_rest(s, target)[source] Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME', formatted for reST. e.g., for the line markerfacecolor property, which has an alias, return 'markerfacecolor or mfc' and for the transform property, which does not, return 'transform'.
matplotlib._as_gen.matplotlib.artist.artistinspector#matplotlib.artist.ArtistInspector.aliased_name_rest
get_aliases()[source] Get a dict mapping property fullnames to sets of aliases for each alias in the ArtistInspector. e.g., for lines: {'markerfacecolor': {'mfc'}, 'linewidth' : {'lw'}, }
matplotlib._as_gen.matplotlib.artist.artistinspector#matplotlib.artist.ArtistInspector.get_aliases
get_setters()[source] Get the attribute strings with setters for object. For example, for a line, return ['markerfacecolor', 'linewidth', ....].
matplotlib._as_gen.matplotlib.artist.artistinspector#matplotlib.artist.ArtistInspector.get_setters
get_valid_values(attr)[source] Get the legal arguments for the setter associated with attr. This is done by querying the docstring of the setter for a line that begins with "ACCEPTS:" or ".. ACCEPTS:", and then by looking for a numpydoc-style documentation for the setter's first argument.
matplotlib._as_gen.matplotlib.artist.artistinspector#matplotlib.artist.ArtistInspector.get_valid_values
is_alias(o)[source] Return whether method object o is an alias for another method.
matplotlib._as_gen.matplotlib.artist.artistinspector#matplotlib.artist.ArtistInspector.is_alias
pprint_getters()[source] Return the getters and actual values as list of strings.
matplotlib._as_gen.matplotlib.artist.artistinspector#matplotlib.artist.ArtistInspector.pprint_getters
pprint_setters(prop=None, leadingspace=2)[source] If prop is None, return a list of strings of all settable properties and their valid values. If prop is not None, it is a valid property name and that property will be returned as a string of property : valid values.
matplotlib._as_gen.matplotlib.artist.artistinspector#matplotlib.artist.ArtistInspector.pprint_setters
pprint_setters_rest(prop=None, leadingspace=4)[source] If prop is None, return a list of reST-formatted strings of all settable properties and their valid values. If prop is not None, it is a valid property name and that property will be returned as a string of "property : valid" values.
matplotlib._as_gen.matplotlib.artist.artistinspector#matplotlib.artist.ArtistInspector.pprint_setters_rest
properties()[source] Return a dictionary mapping property name -> value.
matplotlib._as_gen.matplotlib.artist.artistinspector#matplotlib.artist.ArtistInspector.properties
matplotlib.artist.get matplotlib.artist.get(obj, property=None)[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.artist.get
matplotlib.artist.getp matplotlib.artist.getp(obj, property=None)[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.artist.getp
matplotlib.artist.kwdoc matplotlib.artist.kwdoc(artist)[source] Inspect an Artist class (using ArtistInspector) and return information about its settable properties and their current values. Parameters artistArtist or an iterable of Artists Returns str The settable properties of artist, as plain text if rcParams["docstring.hardcopy"] (default: False) is False and as a rst table (intended for use in Sphinx) if it is True.
matplotlib._as_gen.matplotlib.artist.kwdoc
matplotlib.artist.setp matplotlib.artist.setp(obj, *args, file=None, **kwargs)[source] Set one or more properties on an Artist, or list allowed values. Parameters objArtist or list of Artist The artist(s) whose properties are being set or queried. When setting properties, all artists are affected; when querying the allowed values, only the first instance in the sequence is queried. For example, two lines can be made thicker and red with a single call: >>> x = arange(0, 1, 0.01) >>> lines = plot(x, sin(2*pi*x), x, sin(4*pi*x)) >>> setp(lines, linewidth=2, color='r') filefile-like, default: sys.stdout Where setp writes its output when asked to list allowed values. >>> with open('output.log') as file: ... setp(line, file=file) The default, None, means sys.stdout. *args, **kwargs The properties to set. The following combinations are supported: Set the linestyle of a line to be dashed: >>> line, = plot([1, 2, 3]) >>> setp(line, linestyle='--') Set multiple properties at once: >>> setp(line, linewidth=2, color='r') List allowed values for a line's linestyle: >>> setp(line, 'linestyle') linestyle: {'-', '--', '-.', ':', '', (offset, on-off-seq), ...} List all properties that can be set, and their allowed values: >>> setp(line) agg_filter: a filter function, ... [long output listing omitted] setp also supports MATLAB style string/value pairs. For example, the following are equivalent: >>> setp(lines, 'linewidth', 2, 'color', 'r') # MATLAB style >>> setp(lines, linewidth=2, color='r') # Python style See also getp
matplotlib._as_gen.matplotlib.artist.setp
matplotlib.axes Table of Contents Inheritance The Axes class Subplots Plotting Basic Spans Spectral Statistics Binned Contours 2D arrays Unstructured triangles Text and annotations Vector fields Clearing Appearance Property cycle Axis / limits Axis limits and direction Axis labels, title, and legend Axis scales Autoscaling and margins Aspect ratio Ticks and tick labels Units Adding artists Twinning and sharing Axes position Async/event based Interactive Children Drawing Projection Other Inheritance The Axes class classmatplotlib.axes.Axes(fig, rect, *, facecolor=None, frameon=True, sharex=None, sharey=None, label='', xscale=None, yscale=None, box_aspect=None, **kwargs)[source] Bases: matplotlib.axes._base._AxesBase The Axes contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. The Axes instance supports callbacks through a callbacks attribute which is a CallbackRegistry instance. The events you can connect to are 'xlim_changed' and 'ylim_changed' and the callback will be called with func(ax) where ax is the Axes instance. Attributes dataLimBbox The bounding box enclosing all data displayed in the Axes. viewLimBbox The view limits in data coordinates. Build an Axes in a figure. Parameters figFigure The Axes is built in the Figure fig. rect[left, bottom, width, height] The Axes is built in the rectangle rect. rect is in Figure coordinates. sharex, shareyAxes, optional The x or y axis is shared with the x or y axis in the input Axes. frameonbool, default: True Whether the Axes frame is visible. box_aspectfloat, optional Set a fixed aspect for the Axes box, i.e. the ratio of height to width. See set_box_aspect for details. **kwargs Other optional keyword arguments: 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 Returns Axes The new Axes object. Subplots SubplotBase Base class for subplots, which are Axes instances with additional methods to facilitate generating and manipulating a set of Axes within a figure. subplot_class_factory Plotting Basic Axes.plot Plot y versus x as lines and/or markers. Axes.errorbar Plot y versus x as lines and/or markers with attached errorbars. Axes.scatter A scatter plot of y vs. Axes.plot_date Plot coercing the axis to treat floats as dates. Axes.step Make a step plot. Axes.loglog Make a plot with log scaling on both the x and y axis. Axes.semilogx Make a plot with log scaling on the x axis. Axes.semilogy Make a plot with log scaling on the y axis. Axes.fill_between Fill the area between two horizontal curves. Axes.fill_betweenx Fill the area between two vertical curves. Axes.bar Make a bar plot. Axes.barh Make a horizontal bar plot. Axes.bar_label Label a bar plot. Axes.stem Create a stem plot. Axes.eventplot Plot identical parallel lines at the given positions. Axes.pie Plot a pie chart. Axes.stackplot Draw a stacked area plot. Axes.broken_barh Plot a horizontal sequence of rectangles. Axes.vlines Plot vertical lines at each x from ymin to ymax. Axes.hlines Plot horizontal lines at each y from xmin to xmax. Axes.fill Plot filled polygons. Spans Axes.axhline Add a horizontal line across the axis. Axes.axhspan Add a horizontal span (rectangle) across the Axes. Axes.axvline Add a vertical line across the Axes. Axes.axvspan Add a vertical span (rectangle) across the Axes. Axes.axline Add an infinitely long straight line. Spectral Axes.acorr Plot the autocorrelation of x. Axes.angle_spectrum Plot the angle spectrum. Axes.cohere Plot the coherence between x and y. Axes.csd Plot the cross-spectral density. Axes.magnitude_spectrum Plot the magnitude spectrum. Axes.phase_spectrum Plot the phase spectrum. Axes.psd Plot the power spectral density. Axes.specgram Plot a spectrogram. Axes.xcorr Plot the cross correlation between x and y. Statistics Axes.boxplot Draw a box and whisker plot. Axes.violinplot Make a violin plot. Axes.violin Drawing function for violin plots. Axes.bxp Drawing function for box and whisker plots. Binned Axes.hexbin Make a 2D hexagonal binning plot of points x, y. Axes.hist Plot a histogram. Axes.hist2d Make a 2D histogram plot. Axes.stairs A stepwise constant function as a line with bounding edges or a filled plot. Contours Axes.clabel Label a contour plot. Axes.contour Plot contour lines. Axes.contourf Plot filled contours. 2D arrays Axes.imshow Display data as an image, i.e., on a 2D regular raster. Axes.matshow Plot the values of a 2D matrix or array as color-coded image. Axes.pcolor Create a pseudocolor plot with a non-regular rectangular grid. Axes.pcolorfast Create a pseudocolor plot with a non-regular rectangular grid. Axes.pcolormesh Create a pseudocolor plot with a non-regular rectangular grid. Axes.spy Plot the sparsity pattern of a 2D array. Unstructured triangles Axes.tripcolor Create a pseudocolor plot of an unstructured triangular grid. Axes.triplot Draw a unstructured triangular grid as lines and/or markers. Axes.tricontour Draw contour lines on an unstructured triangular grid. Axes.tricontourf Draw contour regions on an unstructured triangular grid. Text and annotations Axes.annotate Annotate the point xy with text text. Axes.text Add text to the Axes. Axes.table Add a table to an Axes. Axes.arrow Add an arrow to the Axes. Axes.inset_axes Add a child inset Axes to this existing Axes. Axes.indicate_inset Add an inset indicator to the Axes. Axes.indicate_inset_zoom Add an inset indicator rectangle to the Axes based on the axis limits for an inset_ax and draw connectors between inset_ax and the rectangle. Axes.secondary_xaxis Add a second x-axis to this Axes. Axes.secondary_yaxis Add a second y-axis to this Axes. Vector fields Axes.barbs Plot a 2D field of barbs. Axes.quiver Plot a 2D field of arrows. Axes.quiverkey Add a key to a quiver plot. Axes.streamplot Draw streamlines of a vector flow. Clearing Axes.cla Clear the Axes. Axes.clear Clear the Axes. Appearance Axes.axis Convenience method to get or set some axis properties. Axes.set_axis_off Turn the x- and y-axis off. Axes.set_axis_on Turn the x- and y-axis on. Axes.set_frame_on Set whether the Axes rectangle patch is drawn. Axes.get_frame_on Get whether the Axes rectangle patch is drawn. Axes.set_axisbelow Set whether axis ticks and gridlines are above or below most artists. Axes.get_axisbelow Get whether axis ticks and gridlines are above or below most artists. Axes.grid Configure the grid lines. Axes.get_facecolor Get the facecolor of the Axes. Axes.set_facecolor Set the facecolor of the Axes. Property cycle Axes.set_prop_cycle Set the property cycle of the Axes. Axis / limits Axes.get_xaxis Return the XAxis instance. Axes.get_yaxis Return the YAxis instance. Axis limits and direction Axes.invert_xaxis Invert the x-axis. Axes.xaxis_inverted Return whether the xaxis is oriented in the "inverse" direction. Axes.invert_yaxis Invert the y-axis. Axes.yaxis_inverted Return whether the yaxis is oriented in the "inverse" direction. Axes.set_xlim Set the x-axis view limits. Axes.get_xlim Return the x-axis view limits. Axes.set_ylim Set the y-axis view limits. Axes.get_ylim Return the y-axis view limits. Axes.update_datalim Extend the dataLim Bbox to include the given points. Axes.set_xbound Set the lower and upper numerical bounds of the x-axis. Axes.get_xbound Return the lower and upper x-axis bounds, in increasing order. Axes.set_ybound Set the lower and upper numerical bounds of the y-axis. Axes.get_ybound Return the lower and upper y-axis bounds, in increasing order. Axis labels, title, and legend Axes.set_xlabel Set the label for the x-axis. Axes.get_xlabel Get the xlabel text string. Axes.set_ylabel Set the label for the y-axis. Axes.get_ylabel Get the ylabel text string. Axes.set_title Set a title for the Axes. Axes.get_title Get an Axes title. Axes.legend Place a legend on the Axes. Axes.get_legend Return the Legend instance, or None if no legend is defined. Axes.get_legend_handles_labels Return handles and labels for legend Axis scales Axes.set_xscale Set the x-axis scale. Axes.get_xscale Return the xaxis' scale (as a str). Axes.set_yscale Set the y-axis scale. Axes.get_yscale Return the yaxis' scale (as a str). Autoscaling and margins Axes.use_sticky_edges When autoscaling, whether to obey all Artist.sticky_edges. Axes.margins Set or retrieve autoscaling margins. Axes.set_xmargin Set padding of X data limits prior to autoscaling. Axes.set_ymargin Set padding of Y data limits prior to autoscaling. Axes.relim Recompute the data limits based on current artists. Axes.autoscale Autoscale the axis view to the data (toggle). Axes.autoscale_view Autoscale the view limits using the data limits. Axes.set_autoscale_on Set whether autoscaling is applied to each axis on the next draw or call to Axes.autoscale_view. Axes.get_autoscale_on Return True if each axis is autoscaled, False otherwise. Axes.set_autoscalex_on Set whether the x-axis is autoscaled on the next draw or call to Axes.autoscale_view. Axes.get_autoscalex_on Return whether the x-axis is autoscaled. Axes.set_autoscaley_on Set whether the y-axis is autoscaled on the next draw or call to Axes.autoscale_view. Axes.get_autoscaley_on Return whether the y-axis is autoscaled. Aspect ratio Axes.apply_aspect Adjust the Axes for a specified data aspect ratio. Axes.set_aspect Set the aspect ratio of the axes scaling, i.e. y/x-scale. Axes.get_aspect Return the aspect ratio of the axes scaling. Axes.set_box_aspect Set the Axes box aspect, i.e. the ratio of height to width. Axes.get_box_aspect Return the Axes box aspect, i.e. the ratio of height to width. Axes.set_adjustable Set how the Axes adjusts to achieve the required aspect ratio. Axes.get_adjustable Return whether the Axes will adjust its physical dimension ('box') or its data limits ('datalim') to achieve the desired aspect ratio. Ticks and tick labels Axes.set_xticks Set the xaxis' tick locations and optionally labels. Axes.get_xticks Return the xaxis' tick locations in data coordinates. Axes.set_xticklabels Set the xaxis' labels with list of string labels. Axes.get_xticklabels Get the xaxis' tick labels. Axes.get_xmajorticklabels Return the xaxis' major tick labels, as a list of Text. Axes.get_xminorticklabels Return the xaxis' minor tick labels, as a list of Text. Axes.get_xgridlines Return the xaxis' grid lines as a list of Line2Ds. Axes.get_xticklines Return the xaxis' tick lines as a list of Line2Ds. Axes.xaxis_date Set up axis ticks and labels to treat data along the xaxis as dates. Axes.set_yticks Set the yaxis' tick locations and optionally labels. Axes.get_yticks Return the yaxis' tick locations in data coordinates. Axes.set_yticklabels Set the yaxis' labels with list of string labels. Axes.get_yticklabels Get the yaxis' tick labels. Axes.get_ymajorticklabels Return the yaxis' major tick labels, as a list of Text. Axes.get_yminorticklabels Return the yaxis' minor tick labels, as a list of Text. Axes.get_ygridlines Return the yaxis' grid lines as a list of Line2Ds. Axes.get_yticklines Return the yaxis' tick lines as a list of Line2Ds. Axes.yaxis_date Set up axis ticks and labels to treat data along the yaxis as dates. Axes.minorticks_off Remove minor ticks from the Axes. Axes.minorticks_on Display minor ticks on the Axes. Axes.ticklabel_format Configure the ScalarFormatter used by default for linear axes. Axes.tick_params Change the appearance of ticks, tick labels, and gridlines. Axes.locator_params Control behavior of major tick locators. Units Axes.convert_xunits Convert x using the unit type of the xaxis. Axes.convert_yunits Convert y using the unit type of the yaxis. Axes.have_units Return whether units are set on any axis. Adding artists Axes.add_artist Add an Artist to the Axes; return the artist. Axes.add_child_axes Add an AxesBase to the Axes' children; return the child Axes. Axes.add_collection Add a Collection to the Axes; return the collection. Axes.add_container Add a Container to the axes' containers; return the container. Axes.add_image Add an AxesImage to the Axes; return the image. Axes.add_line Add a Line2D to the Axes; return the line. Axes.add_patch Add a Patch to the Axes; return the patch. Axes.add_table Add a Table to the Axes; return the table. Twinning and sharing Axes.twinx Create a twin Axes sharing the xaxis. Axes.twiny Create a twin Axes sharing the yaxis. Axes.sharex Share the x-axis with other. Axes.sharey Share the y-axis with other. Axes.get_shared_x_axes Return a reference to the shared axes Grouper object for x axes. Axes.get_shared_y_axes Return a reference to the shared axes Grouper object for y axes. Axes position Axes.get_anchor Get the anchor location. Axes.set_anchor Define the anchor location. Axes.get_axes_locator Return the axes_locator. Axes.set_axes_locator Set the Axes locator. Axes.reset_position Reset the active position to the original position. Axes.get_position Return the position of the Axes within the figure as a Bbox. Axes.set_position Set the Axes position. Async/event based Axes.stale Whether the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist. Axes.pchanged Call all of the registered callbacks. Axes.add_callback Add a callback function that will be called whenever one of the Artist's properties changes. Axes.remove_callback Remove a callback based on its observer id. Interactive Axes.can_pan Return whether this Axes supports any pan/zoom button functionality. Axes.can_zoom Return whether this Axes supports the zoom box button functionality. Axes.get_navigate Get whether the Axes responds to navigation commands. Axes.set_navigate Set whether the Axes responds to navigation toolbar commands. Axes.get_navigate_mode Get the navigation toolbar button status: 'PAN', 'ZOOM', or None. Axes.set_navigate_mode Set the navigation toolbar button status. Axes.start_pan Called when a pan operation has started. Axes.drag_pan Called when the mouse moves during a pan operation. Axes.end_pan Called when a pan operation completes (when the mouse button is up.) Axes.format_coord Return a format string formatting the x, y coordinates. Axes.format_cursor_data Return a string representation of data. Axes.format_xdata Return x formatted as an x-value. Axes.format_ydata Return y formatted as an y-value. Axes.mouseover If this property is set to True, the artist will be queried for custom context information when the mouse cursor moves over it. Axes.in_axes Return whether the given event (in display coords) is in the Axes. Axes.contains Test whether the artist contains the mouse event. Axes.contains_point Return whether point (pair of pixel coordinates) is inside the axes patch. Axes.get_cursor_data Return the cursor data for a given event. Children Axes.get_children Return a list of the child Artists of this Artist. Axes.get_images Return a list of AxesImages contained by the Axes. Axes.get_lines Return a list of lines contained by the Axes. Axes.findobj Find artist objects. Drawing Axes.draw Draw the Artist (and its children) using the given renderer. Axes.draw_artist Efficiently redraw a single artist. Axes.redraw_in_frame Efficiently redraw Axes data, but not axis ticks, labels, etc. Axes.get_renderer_cache Axes.get_rasterization_zorder Return the zorder value below which artists will be rasterized. Axes.set_rasterization_zorder Set the zorder threshold for rasterization for vector graphics output. Axes.get_window_extent Return the Axes bounding box in display space; args and kwargs are empty. Axes.get_tightbbox Return the tight bounding box of the axes, including axis and their decorators (xlabel, title, etc). Projection Methods used by Axis that must be overridden for non-rectilinear Axes. Axes.name Axes.get_xaxis_transform Get the transformation used for drawing x-axis labels, ticks and gridlines. Axes.get_yaxis_transform Get the transformation used for drawing y-axis labels, ticks and gridlines. Axes.get_data_ratio Return the aspect ratio of the scaled data. Axes.get_xaxis_text1_transform Returns Axes.get_xaxis_text2_transform Returns Axes.get_yaxis_text1_transform Returns Axes.get_yaxis_text2_transform Returns Other Axes.zorder Axes.get_default_bbox_extra_artists Return a default list of artists that are used for the bounding box calculation. Axes.get_transformed_clip_path_and_affine Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation. Axes.has_data Return whether any artists have been added to the Axes. Axes.set Set multiple properties at once.
matplotlib.axes_api
classmatplotlib.axes.Axes(fig, rect, *, facecolor=None, frameon=True, sharex=None, sharey=None, label='', xscale=None, yscale=None, box_aspect=None, **kwargs)[source] Bases: matplotlib.axes._base._AxesBase The Axes contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. The Axes instance supports callbacks through a callbacks attribute which is a CallbackRegistry instance. The events you can connect to are 'xlim_changed' and 'ylim_changed' and the callback will be called with func(ax) where ax is the Axes instance. Attributes dataLimBbox The bounding box enclosing all data displayed in the Axes. viewLimBbox The view limits in data coordinates. Build an Axes in a figure. Parameters figFigure The Axes is built in the Figure fig. rect[left, bottom, width, height] The Axes is built in the rectangle rect. rect is in Figure coordinates. sharex, shareyAxes, optional The x or y axis is shared with the x or y axis in the input Axes. frameonbool, default: True Whether the Axes frame is visible. box_aspectfloat, optional Set a fixed aspect for the Axes box, i.e. the ratio of height to width. See set_box_aspect for details. **kwargs Other optional keyword arguments: 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 Returns Axes The new Axes object.
matplotlib.axes_api#matplotlib.axes.Axes
matplotlib.axes.Axes.acorr Axes.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". Examples using matplotlib.axes.Axes.acorr Cross- and Auto-Correlation Demo
matplotlib._as_gen.matplotlib.axes.axes.acorr
matplotlib.axes.Axes.add_artist Axes.add_artist(a)[source] Add an Artist to the Axes; return the artist. Use add_artist only for artists for which there is no dedicated "add" method; and if necessary, use a method such as update_datalim to manually update the dataLim if the artist is to be included in autoscaling. If no transform has been specified when creating the artist (e.g. artist.get_transform() == None) then the transform is set to ax.transData. Examples using matplotlib.axes.Axes.add_artist Scatter plots with a legend BboxImage Demo Bar of pie Annotating Plots AnnotationBbox demo Using a text as a Path Ellipse Demo Anchored Direction Arrow Axes Grid2 Inset Locator Demo2 Simple Anchored Artists Anatomy of a figure Anchored Artists Artist tests Anchored Box04 Annotate Explain Connect Simple01 Simple Annotate01 Simple Legend02 Legend guide Annotations
matplotlib._as_gen.matplotlib.axes.axes.add_artist
matplotlib.axes.Axes.add_callback Axes.add_callback(func)[source] Add a callback function that will be called whenever one of the Artist's properties changes. Parameters funccallable The callback function. It must have the signature: def func(artist: Artist) -> Any where artist is the calling Artist. Return values may exist but are ignored. Returns int The observer id associated with the callback. This id can be used for removing the callback with remove_callback later. See also remove_callback
matplotlib._as_gen.matplotlib.axes.axes.add_callback
matplotlib.axes.Axes.add_child_axes Axes.add_child_axes(ax)[source] Add an AxesBase to the Axes' children; return the child Axes. This is the lowlevel version. See axes.Axes.inset_axes.
matplotlib._as_gen.matplotlib.axes.axes.add_child_axes
matplotlib.axes.Axes.add_collection Axes.add_collection(collection, autolim=True)[source] Add a Collection to the Axes; return the collection. Examples using matplotlib.axes.Axes.add_collection EventCollection Demo Using span_where Creating boxes from error bars using PatchCollection Reference for Matplotlib artists Line, Poly and RegularPoly Collection with autoscaling Ellipse Collection Line Collection Circles, Wedges and Polygons Lasso Demo MRI With EEG Artist tests Autoscaling
matplotlib._as_gen.matplotlib.axes.axes.add_collection
matplotlib.axes.Axes.add_container Axes.add_container(container)[source] Add a Container to the axes' containers; return the container.
matplotlib._as_gen.matplotlib.axes.axes.add_container
matplotlib.axes.Axes.add_image Axes.add_image(image)[source] Add an AxesImage to the Axes; return the image. Examples using matplotlib.axes.Axes.add_image Image Nonuniform
matplotlib._as_gen.matplotlib.axes.axes.add_image
matplotlib.axes.Axes.add_line Axes.add_line(line)[source] Add a Line2D to the Axes; return the line. Examples using matplotlib.axes.Axes.add_line Artist within an artist Reference for Matplotlib artists Artist tests Artist tutorial
matplotlib._as_gen.matplotlib.axes.axes.add_line
matplotlib.axes.Axes.add_patch Axes.add_patch(p)[source] Add a Patch to the Axes; return the patch. Examples using matplotlib.axes.Axes.add_patch Curve with error band Image Demo Axes box aspect Controlling view limits using margins and sticky_edges Boxplots Plot a confidence ellipse of a two-dimensional dataset Annotating Plots Precise text layout Compound path Dolphins Mmh Donuts!!! Drawing fancy boxes Hatch style reference PathPatch object Bezier Curve ggplot style sheet Inset Locator Demo Firefox Integral as the area under a curve Looking Glass Path Editor Poly Editor Trifinder Event Demo Viewlims Changing colors of lines intersecting a box Building histograms using Rectangles and PolyCollections Packed-bubble chart SVG Filter Pie TickedStroke patheffect Draw flat objects in 3D plot Artist tests Ellipse With Units Artist tutorial Legend guide Path Tutorial Transformations Tutorial Specifying Colors Text properties and layout
matplotlib._as_gen.matplotlib.axes.axes.add_patch
matplotlib.axes.Axes.add_table Axes.add_table(tab)[source] Add a Table to the Axes; return the table.
matplotlib._as_gen.matplotlib.axes.axes.add_table
matplotlib.axes.Axes.angle_spectrum Axes.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.axes.axes.angle_spectrum
matplotlib.axes.Axes.annotate Axes.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.axes.Axes.annotate Broken Barh Hat graph Creating a timeline with lines, dates, and text Combining two subplots using subplots and GridSpec Labeling a pie and a donut Scale invariant angle label Annotating Plots Annotation arrow style reference Rendering math equations using TeX Annotate Transform Annotating a plot Annotation Polar Text Commands Mmh Donuts!!! axis_direction demo Simple Axis Pad XKCD Patheffect Demo Annotation with units Annotate Explain Annotate Simple01 Annotate Simple02 Annotate Simple03 Annotate Simple04 Annotate Simple Coord01 Annotate Simple Coord02 Annotate Simple Coord03 Connection styles for annotations Simple Annotate01 Basic Usage Faster rendering by using blitting Transformations Tutorial Text in Matplotlib Plots Annotations
matplotlib._as_gen.matplotlib.axes.axes.annotate
matplotlib.axes.Axes.apply_aspect Axes.apply_aspect(position=None)[source] Adjust the Axes for a specified data aspect ratio. Depending on get_adjustable this will modify either the Axes box (position) or the view limits. In the former case, get_anchor will affect the position. See also matplotlib.axes.Axes.set_aspect For a description of aspect ratio handling. matplotlib.axes.Axes.set_adjustable Set how the Axes adjusts to achieve the required aspect ratio. matplotlib.axes.Axes.set_anchor Set the position in case of extra space. Notes This is called automatically when each Axes is drawn. You may need to call it yourself if you need to update the Axes position and/or view limits before the Figure is drawn.
matplotlib._as_gen.matplotlib.axes.axes.apply_aspect
matplotlib.axes.Axes.arrow Axes.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="->")) Examples using matplotlib.axes.Axes.arrow Arrow Demo
matplotlib._as_gen.matplotlib.axes.axes.arrow
matplotlib.axes.Axes.autoscale Axes.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. Examples using matplotlib.axes.Axes.autoscale Axes box aspect Autoscaling
matplotlib._as_gen.matplotlib.axes.axes.autoscale
matplotlib.axes.Axes.autoscale_view Axes.autoscale_view(tight=None, scalex=True, scaley=True)[source] Autoscale the view limits using the data limits. Parameters tightbool or None If True, only expand the axis limits using the margins. Note that unlike for autoscale, tight=True does not set the margins to zero. If False and rcParams["axes.autolimit_mode"] (default: 'data') is 'round_numbers', then after expansion by the margins, further expand the axis limits using the axis major locator. If None (the default), reuse the value set in the previous call to autoscale_view (the initial value is False, but the default style sets rcParams["axes.autolimit_mode"] (default: 'data') to 'data', in which case this behaves like True). scalexbool, default: True Whether to autoscale the x axis. scaleybool, default: True Whether to autoscale the y axis. Notes The autoscaling preserves any preexisting axis direction reversal. The data limits are not updated automatically when artist data are changed after the artist has been added to an Axes instance. In that case, use matplotlib.axes.Axes.relim() prior to calling autoscale_view. If the views of the Axes are fixed, e.g. via set_xlim, they will not be changed by autoscale_view(). See matplotlib.axes.Axes.autoscale() for an alternative. Examples using matplotlib.axes.Axes.autoscale_view Line, Poly and RegularPoly Collection with autoscaling Compound path Ellipse Collection Packed-bubble chart Group barchart with units Textbox Autoscaling
matplotlib._as_gen.matplotlib.axes.axes.autoscale_view
matplotlib.axes.Axes.axhline Axes.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.axes.Axes.axhline Bar Label Demo Filling the area between lines Using span_where axhspan Demo Plot a confidence ellipse of a two-dimensional dataset Multiline Usetex Baseline Test Cross hair cursor Transformations Tutorial
matplotlib._as_gen.matplotlib.axes.axes.axhline