WrightTools.artists.Axes

class WrightTools.artists.Axes(fig, rect, facecolor=None, frameon=True, sharex=None, sharey=None, label='', xscale=None, yscale=None, box_aspect=None, **kwargs)[source]

Axes.

__init__(fig, rect, facecolor=None, frameon=True, sharex=None, sharey=None, label='', xscale=None, yscale=None, box_aspect=None, **kwargs)

Build an axes in a figure.

Parameters
  • fig (~matplotlib.figure.Figure) – The axes is build in the .Figure fig.

  • rect ([left, bottom, width, height]) – The axes is build in the rectangle rect. rect is in .Figure coordinates.

  • sharex (~.axes.Axes, optional) – The x or y ~.matplotlib.axis is shared with the x or y axis in the input ~.axes.Axes.

  • sharey (~.axes.Axes, optional) – The x or y ~.matplotlib.axis is shared with the x or y axis in the input ~.axes.Axes.

  • frameon (bool, default: True) – Whether the axes frame is visible.

  • box_aspect (None, or a number, optional) – Sets the aspect of the axes box. See ~.axes.Axes.set_box_aspect for details.

  • **kwargs

    Other optional keyword arguments:

    Properties: 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: float or None anchor: 2-tuple of floats or {‘C’, ‘SW’, ‘S’, ‘SE’, …} animated: bool aspect: {‘auto’} or num autoscale_on: bool autoscalex_on: bool autoscaley_on: bool axes_locator: Callable[[Axes, Renderer], Bbox] axisbelow: bool or ‘line’ box_aspect: None, or a number clip_box: .Bbox clip_on: bool clip_path: Patch or (Path, Transform) or None contains: unknown 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 callable position: [left, bottom, width, height] or ~matplotlib.transforms.Bbox prop_cycle: unknown rasterization_zorder: float or None rasterized: bool or None 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”, …} xticklabels: unknown xticks: unknown ybound: unknown ylabel: str ylim: (bottom: float, top: float) ymargin: float greater than -0.5 yscale: {“linear”, “log”, “symlog”, “logit”, …} yticklabels: unknown yticks: unknown zorder: float

Returns

The new ~.axes.Axes object.

Return type

~.axes.Axes

Methods

__init__(fig, rect[, facecolor, frameon, …])

Build an axes in a figure.

acorr(x, *[, data])

Plot the autocorrelation of x.

add_artist(a)

Add an ~.Artist to the axes, and return the artist.

add_callback(func)

Add a callback function that will be called whenever one of the .Artist’s properties changes.

add_child_axes(ax)

Add an ~.AxesBase to the axes’ children; return the child axes.

add_collection(collection[, autolim])

Add a ~.Collection to the axes’ collections; return the collection.

add_container(container)

Add a ~.Container to the axes’ containers; return the container.

add_image(image)

Add an ~.AxesImage to the axes’ images; return the image.

add_line(line)

Add a .Line2D to the axes’ lines; return the line.

add_patch(p)

Add a ~.Patch to the axes’ patches; return the patch.

add_sideplot(along[, pad, height, ymin, ymax])

Add a side axis.

add_table(tab)

Add a ~.Table to the axes’ tables; return the table.

angle_spectrum(x[, Fs, Fc, window, pad_to, …])

Plot the angle spectrum.

annotate(text, xy, *args, **kwargs)

Annotate the point xy with text text.

apply_aspect([position])

Adjust the Axes for a specified data aspect ratio.

arrow(x, y, dx, dy, **kwargs)

Add an arrow to the axes.

autoscale([enable, axis, tight])

Autoscale the axis view to the data (toggle).

autoscale_view([tight, scalex, scaley])

Autoscale the view limits using the data limits.

axhline([y, xmin, xmax])

Add a horizontal line across the axis.

axhspan(ymin, ymax[, xmin, xmax])

Add a horizontal span (rectangle) across the axis.

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.

barbs(*args[, data])

Plot a 2D field of barbs.

barh(y, width[, height, left, align])

Make a horizontal bar plot.

boxplot(x[, notch, sym, vert, whis, …])

Make a box and whisker plot.

broken_barh(xranges, yrange, *[, data])

Plot a horizontal sequence of rectangles.

bxp(bxpstats[, positions, widths, vert, …])

Drawing function for box and whisker plots.

can_pan()

Return True if this axes supports any pan/zoom button functionality.

can_zoom()

Return True if this axes supports the zoom box button functionality.

cla()

Clear the current axes.

clabel(CS[, levels])

Label a contour plot.

clear()

Clear the axes.

cohere(x, y[, NFFT, Fs, Fc, detrend, …])

Plot the coherence between x and y.

contains(mouseevent)

Test whether the artist contains the mouse event.

contains_point(point)

Return whether point (pair of pixel coordinates) is inside the axes patch.

contour(*args, **kwargs)

Plot contours.

contourf(*args, **kwargs)

Plot contours.

convert_xunits(x)

Convert x using the unit type of the xaxis.

convert_yunits(y)

Convert y using the unit type of the yaxis.

csd(x, y[, NFFT, Fs, Fc, detrend, window, …])

Plot the cross-spectral density.

drag_pan(button, key, x, y)

Called when the mouse moves during a pan operation.

draw([renderer, inframe])

Draw the Artist (and its children) using the given renderer.

draw_artist(a)

Efficiently redraw a single artist.

end_pan()

Called when a pan operation completes (when the mouse button is up.)

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.

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([match, include_self])

Find artist objects.

format_coord(x, y)

Return a format string formatting the x, y coordinates.

format_cursor_data(data)

Return a string representation of data.

format_xdata(x)

Return x formatted as an x-value.

format_ydata(y)

Return y formatted as an y-value.

get_adjustable()

Return whether the Axes will adjust its physical dimension (‘box’) or its data limits (‘datalim’) to achieve the desired aspect ratio.

get_agg_filter()

Return filter function to be used for agg filter.

get_alpha()

Return the alpha value used for blending - not supported on all backends.

get_anchor()

Get the anchor location.

get_animated()

Return whether the artist is animated.

get_aspect()

get_autoscale_on()

Get whether autoscaling is applied for both axes on plot commands

get_autoscalex_on()

Get whether autoscaling for the x-axis is applied on plot commands

get_autoscaley_on()

Get whether autoscaling for the y-axis is applied on plot commands

get_axes_locator()

Return the axes_locator.

get_axisbelow()

Get whether axis ticks and gridlines are above or below most artists.

get_box_aspect()

Get the axes box aspect.

get_children()

Return a list of the child .Artists of this .Artist.

get_clip_box()

Return the clipbox.

get_clip_on()

Return whether the artist uses clipping.

get_clip_path()

Return the clip path.

get_contains()

[Deprecated] Return the custom contains function of the artist if set, or None.

get_cursor_data(event)

Return the cursor data for a given event.

get_data_ratio()

Return the aspect ratio of the scaled data.

get_data_ratio_log()

[Deprecated] Return the aspect ratio of the raw data in log scale.

get_default_bbox_extra_artists()

Return a default list of artists that are used for the bounding box calculation.

get_facecolor()

Get the facecolor of the Axes.

get_fc()

Alias for get_facecolor.

get_figure()

Return the .Figure instance the artist belongs to.

get_frame_on()

Get whether the axes rectangle patch is drawn.

get_gid()

Return the group id.

get_images()

Return a list of .AxesImages contained by the Axes.

get_in_layout()

Return boolean flag, True if artist is included in layout calculations.

get_label()

Return the label used for this artist in the legend.

get_legend()

Return the .Legend instance, or None if no legend is defined.

get_legend_handles_labels([legend_handler_map])

Return handles and labels for legend

get_lines()

Return a list of lines contained by the Axes.

get_navigate()

Get whether the axes responds to navigation commands

get_navigate_mode()

Get the navigation toolbar button status: ‘PAN’, ‘ZOOM’, or None

get_path_effects()

get_picker()

Return the picking behavior of the artist.

get_position([original])

Get a copy of the axes rectangle as a .Bbox.

get_rasterization_zorder()

Return the zorder value below which artists will be rasterized.

get_rasterized()

Return whether the artist is to be rasterized.

get_renderer_cache()

get_shared_x_axes()

Return a reference to the shared axes Grouper object for x axes.

get_shared_y_axes()

Return a reference to the shared axes Grouper object for y axes.

get_sketch_params()

Return the sketch parameters for the artist.

get_snap()

Return the snap setting.

get_tightbbox(renderer[, call_axes_locator, …])

Return the tight bounding box of the axes, including axis and their decorators (xlabel, title, etc).

get_title([loc])

Get an axes title.

get_transform()

Return the .Transform instance used by this artist.

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.

get_url()

Return the url.

get_visible()

Return the visibility.

get_window_extent(*args, **kwargs)

Return the axes bounding box in display space; args and kwargs are empty.

get_xaxis()

Return the XAxis instance.

get_xaxis_text1_transform(pad_points)

returns
  • transform (Transform) – The transform used for drawing x-axis labels, which will add

get_xaxis_text2_transform(pad_points)

returns
  • transform (Transform) – The transform used for drawing secondary x-axis labels, which will

get_xaxis_transform([which])

Get the transformation used for drawing x-axis labels, ticks and gridlines.

get_xbound()

Return the lower and upper x-axis bounds, in increasing order.

get_xgridlines()

Return the xaxis’ grid lines as a list of .Line2Ds.

get_xlabel()

Get the xlabel text string.

get_xlim()

Return the x-axis view limits.

get_xmajorticklabels()

Return the xaxis’ major tick labels, as a list of ~.text.Text.

get_xminorticklabels()

Return the xaxis’ minor tick labels, as a list of ~.text.Text.

get_xscale()

Return the xaxis’ scale (as a str).

get_xticklabels([minor, which])

Get the xaxis’ tick labels.

get_xticklines([minor])

Return the xaxis’ tick lines as a list of .Line2Ds.

get_xticks(*[, minor])

Return the xaxis’ tick locations in data coordinates.

get_yaxis()

Return the YAxis instance.

get_yaxis_text1_transform(pad_points)

returns
  • transform (Transform) – The transform used for drawing y-axis labels, which will add

get_yaxis_text2_transform(pad_points)

returns
  • transform (Transform) – The transform used for drawing secondart y-axis labels, which will

get_yaxis_transform([which])

Get the transformation used for drawing y-axis labels, ticks and gridlines.

get_ybound()

Return the lower and upper y-axis bounds, in increasing order.

get_ygridlines()

Return the yaxis’ grid lines as a list of .Line2Ds.

get_ylabel()

Get the ylabel text string.

get_ylim()

Return the y-axis view limits.

get_ymajorticklabels()

Return the yaxis’ major tick labels, as a list of ~.text.Text.

get_yminorticklabels()

Return the yaxis’ minor tick labels, as a list of ~.text.Text.

get_yscale()

Return the yaxis’ scale (as a str).

get_yticklabels([minor, which])

Get the yaxis’ tick labels.

get_yticklines([minor])

Return the yaxis’ tick lines as a list of .Line2Ds.

get_yticks(*[, minor])

Return the yaxis’ tick locations in data coordinates.

get_zorder()

Return the artist’s zorder.

grid([b, which, axis])

Configure the grid lines.

has_data()

Return True if any artists have been added to axes.

have_units()

Return True if units are set on any axis.

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.

imshow(X[, cmap, norm, aspect, …])

Display data as an image, i.e., on a 2D regular raster.

in_axes(mouseevent)

Return True if the given mouseevent (in display coords) is in the Axes

indicate_inset(bounds[, inset_ax, …])

Add an inset indicator to the axes.

indicate_inset_zoom(inset_ax, **kwargs)

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.

inset_axes(bounds, *[, transform, zorder])

Add a child inset axes to this existing axes.

invert_xaxis()

Invert the x-axis.

invert_yaxis()

Invert the y-axis.

is_transform_set()

Return whether the Artist has an explicitly set transform.

legend(*args, **kwargs)

Add a legend.

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.

magnitude_spectrum(x[, Fs, Fc, window, …])

Plot the magnitude spectrum.

margins(*margins[, x, y, tight])

Set or retrieve autoscaling margins.

matshow(Z, **kwargs)

Plot the values of a 2D matrix or array as color-coded image.

minorticks_off()

Remove minor ticks from the axes.

minorticks_on()

Display minor ticks on the axes.

pchanged()

Call all of the registered callbacks.

pcolor(*args, **kwargs)

Create a pseudocolor plot of a 2-D array.

pcolorfast(*args[, alpha, norm, cmap, vmin, …])

Create a pseudocolor plot with a non-regular rectangular grid.

pcolormesh(*args, **kwargs)

Create a pseudocolor plot of a 2-D array.

phase_spectrum(x[, Fs, Fc, window, pad_to, …])

Plot the phase spectrum.

pick(mouseevent)

Process a pick event.

pickable()

Return whether the artist is pickable.

pie(x[, explode, labels, colors, autopct, …])

Plot a pie chart.

plot(*args, **kwargs)

Plot lines and/or markers.

plot_date(x, y[, fmt, tz, xdate, ydate, data])

Plot data that contains dates.

properties()

Return a dictionary of all the properties of the artist.

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, **kw)

Add a key to a quiver plot.

redraw_in_frame()

Efficiently redraw Axes data, but not axis ticks, labels, etc.

relim([visible_only])

Recompute the data limits based on current artists.

remove()

Remove the artist from the figure if possible.

remove_callback(oid)

Remove a callback based on its observer id.

reset_position()

Reset the active position to the original position.

scatter(x, y[, s, c, marker, cmap, norm, …])

A scatter plot of y vs.

secondary_xaxis(location, *[, functions])

Add a second x-axis to this axes.

secondary_yaxis(location, *[, functions])

Add a second y-axis to this axes.

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(**kwargs)

A property batch setter.

set_adjustable(adjustable[, share])

Set how the Axes adjusts to achieve the required aspect ratio.

set_agg_filter(filter_func)

Set the agg filter.

set_alpha(alpha)

Set the alpha value used for blending - not supported on all backends.

set_anchor(anchor[, share])

Define the anchor location.

set_animated(b)

Set the artist’s animation state.

set_aspect(aspect[, adjustable, anchor, share])

Set the aspect of the axis scaling, i.e. the ratio of y-unit to x-unit.

set_autoscale_on(b)

Set whether autoscaling is applied on plot commands

set_autoscalex_on(b)

Set whether autoscaling for the x-axis is applied on plot commands

set_autoscaley_on(b)

Set whether autoscaling for the y-axis is applied on plot commands

set_axes_locator(locator)

Set the axes locator.

set_axis_off()

Turn the x- and y-axis off.

set_axis_on()

Turn the x- and y-axis on.

set_axisbelow(b)

Set whether axis ticks and gridlines are above or below most artists.

set_box_aspect([aspect])

Set the axes box aspect.

set_clip_box(clipbox)

Set the artist’s clip .Bbox.

set_clip_on(b)

Set whether the artist uses clipping.

set_clip_path(path[, transform])

Set the artist’s clip path.

set_contains(picker)

[Deprecated] Define a custom contains test for the artist.

set_facecolor(color)

Set the facecolor of the Axes.

set_fc(color)

Alias for set_facecolor.

set_figure(fig)

Set the .Figure instance the artist belongs to.

set_frame_on(b)

Set whether the axes rectangle patch is drawn.

set_gid(gid)

Set the (group) id for the artist.

set_in_layout(in_layout)

Set if artist is to be included in layout calculations, E.g.

set_label(s)

Set a label that will be displayed in the legend.

set_navigate(b)

Set whether the axes responds to navigation toolbar commands

set_navigate_mode(b)

Set the navigation toolbar button status;

set_path_effects(path_effects)

Set the path effects.

set_picker(picker)

Define the picking behavior of the artist.

set_position(pos[, which])

Set the axes position.

set_prop_cycle(*args, **kwargs)

Set the property cycle of the Axes.

set_rasterization_zorder(z)

param z

zorder below which artists are rasterized. None means that

set_rasterized(rasterized)

Force rasterized (bitmap) drawing in vector backend output.

set_sketch_params([scale, length, randomness])

Sets the sketch parameters.

set_snap(snap)

Set the snapping behavior.

set_title(label[, fontdict, loc, pad, y])

Set a title for the axes.

set_transform(t)

Set the artist transform.

set_url(url)

Set the url for the artist.

set_visible(b)

Set the artist’s visibility.

set_xbound([lower, upper])

Set the lower and upper numerical bounds of the x-axis.

set_xlabel(xlabel[, fontdict, labelpad, loc])

Set the label for the x-axis.

set_xlim([left, right, emit, auto, xmin, xmax])

Set the x-axis view limits.

set_xmargin(m)

Set padding of X data limits prior to autoscaling.

set_xscale(value, **kwargs)

Set the x-axis scale.

set_xticklabels(labels, *[, fontdict, minor])

Set the xaxis’ labels with list of string labels.

set_xticks(ticks, *[, minor])

Set the xaxis’ tick locations.

set_ybound([lower, upper])

Set the lower and upper numerical bounds of the y-axis.

set_ylabel(ylabel[, fontdict, labelpad, loc])

Set the label for the y-axis.

set_ylim([bottom, top, emit, auto, ymin, ymax])

Set the y-axis view limits.

set_ymargin(m)

Set padding of Y data limits prior to autoscaling.

set_yscale(value, **kwargs)

Set the y-axis scale.

set_yticklabels(labels, *[, fontdict, minor])

Set the yaxis’ labels with list of string labels.

set_yticks(ticks, *[, minor])

Set the yaxis’ tick locations.

set_zorder(level)

Set the zorder for the artist.

sharex(other)

Share the x-axis with other.

sharey(other)

Share the y-axis with other.

specgram(x[, NFFT, Fs, Fc, detrend, window, …])

Plot a spectrogram.

spy(Z[, precision, marker, markersize, …])

Plot the sparsity pattern of a 2D array.

stackplot(x, *args[, labels, colors, …])

Draw a stacked area plot.

start_pan(x, y, button)

Called when a pan operation has started.

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.

table([cellText, cellColours, cellLoc, …])

Add a table to an ~.axes.Axes.

text(x, y, s[, fontdict])

Add text to the axes.

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.

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()

Create a twin Axes sharing the xaxis.

twiny()

Create a twin Axes sharing the yaxis.

update(props)

Update this artist’s properties from the dict props.

update_datalim(xys[, updatex, updatey])

Extend the ~.Axes.dataLim Bbox to include the given points.

update_datalim_bounds(bounds)

[Deprecated] Extend the ~.Axes.datalim Bbox to include the given ~matplotlib.transforms.Bbox.

update_from(other)

Copy properties from other to self.

violin(vpstats[, positions, vert, widths, …])

Drawing function for violin plots.

violinplot(dataset[, positions, vert, …])

Make a violin plot.

vlines(x, ymin, ymax[, colors, linestyles, …])

Plot vertical lines.

xaxis_date([tz])

Sets up axis ticks and labels to treat data along the xaxis as dates.

xaxis_inverted()

Return whether the xaxis is oriented in the “inverse” direction.

xcorr(x, y[, normed, detrend, usevlines, …])

Plot the cross correlation between x and y.

yaxis_date([tz])

Sets up axis ticks and labels to treat data along the yaxis as dates.

yaxis_inverted()

Return whether the yaxis is oriented in the “inverse” direction.

Attributes

axes

The ~.axes.Axes instance the artist resides in, or None.

is_sideplot

mouseover

If this property is set to True, the artist will be queried for custom context information when the mouse cursor moves over it.

name

stale

Whether the artist is ‘stale’ and needs to be re-drawn for the output to match the internal state of the artist.

sticky_edges

x and y sticky edge lists for autoscaling.

transposed

use_sticky_edges

When autoscaling, whether to obey all Artist.sticky_edges.

viewLim

zorder