WrightTools.artists.Figure

class WrightTools.artists.Figure(figsize=None, dpi=None, facecolor=None, edgecolor=None, linewidth=0.0, frameon=None, subplotpars=None, tight_layout=None, constrained_layout=None)[source]

Figure.

__init__(figsize=None, dpi=None, facecolor=None, edgecolor=None, linewidth=0.0, frameon=None, subplotpars=None, tight_layout=None, constrained_layout=None)[source]
Parameters
  • figsize (2-tuple of floats, default: :rc:`figure.figsize`) – Figure dimension (width, height) in inches.

  • dpi (float, default: :rc:`figure.dpi`) – Dots per inch.

  • facecolor (default: :rc:`figure.facecolor`) – The figure patch facecolor.

  • edgecolor (default: :rc:`figure.edgecolor`) – The figure patch edge color.

  • linewidth (float) – The linewidth of the frame (i.e. the edge linewidth of the figure patch).

  • frameon (bool, default: :rc:`figure.frameon`) – If False, suppress drawing the figure background patch.

  • subplotpars (SubplotParams) – Subplot parameters. If not given, the default subplot parameters :rc:`figure.subplot.*` are used.

  • tight_layout (bool or dict, default: :rc:`figure.autolayout`) – If False use subplotpars. If True adjust subplot parameters using .tight_layout with default padding. When providing a dict containing the keys pad, w_pad, h_pad, and rect, the default .tight_layout paddings will be overridden.

  • constrained_layout (bool, default: :rc:`figure.constrained_layout.use`) – If True use constrained layout to adjust positioning of plot elements. Like tight_layout, but designed to be more flexible. See /tutorials/intermediate/constrainedlayout_guide for examples. (Note: does not work with add_subplot or ~.pyplot.subplot2grid.)

Methods

__init__([figsize, dpi, facecolor, …])

param figsize

Figure dimension (width, height) in inches.

add_artist(artist[, clip])

Add an .Artist to the figure.

add_axes(*args, **kwargs)

Add an axes to the figure.

add_axobserver(func)

Whenever the axes state change, func(self) will be called.

add_callback(func)

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

add_gridspec([nrows, ncols])

Return a .GridSpec that has this figure as a parent.

add_subplot(*args, **kwargs)

Add a subplot to the figure.

align_labels([axs])

Align the xlabels and ylabels of subplots with the same subplots row or column (respectively) if label alignment is being done automatically (i.e.

align_xlabels([axs])

Align the xlabels of subplots in the same subplot column if label alignment is being done automatically (i.e.

align_ylabels([axs])

Align the ylabels of subplots in the same subplot column if label alignment is being done automatically (i.e.

autofmt_xdate([bottom, rotation, ha, which])

Date ticklabels often overlap, so it is useful to rotate them and right align them.

clear([keep_observers])

Clear the figure – synonym for clf.

clf([keep_observers])

Clear the figure.

colorbar(mappable[, cax, ax, use_gridspec])

Create a colorbar for a ScalarMappable instance, mappable.

contains(mouseevent)

Test whether the mouse event occurred on the figure.

convert_xunits(x)

Convert x using the unit type of the xaxis.

convert_yunits(y)

Convert y using the unit type of the yaxis.

delaxes(ax)

Remove the ~.axes.Axes ax from the figure; update the current axes.

draw(renderer)

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

draw_artist(a)

Draw .Artist instance a only.

execute_constrained_layout([renderer])

Use layoutbox to determine pos positions within axes.

figimage(X[, xo, yo, alpha, norm, cmap, …])

Add a non-resampled image to the figure.

findobj([match, include_self])

Find artist objects.

format_cursor_data(data)

Return a string representation of data.

gca(**kwargs)

Get the current axes, creating one if necessary.

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

Return whether the artist is animated.

get_axes()

Return a list of axes in the Figure.

get_children()

Get a list of artists contained in the figure.

get_clip_box()

Return the clipbox.

get_clip_on()

Return whether the artist uses clipping.

get_clip_path()

Return the clip path.

get_constrained_layout()

Return whether constrained layout is being used.

get_constrained_layout_pads([relative])

Get padding for constrained_layout.

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

get_dpi()

Return the resolution in dots per inch as a float.

get_edgecolor()

Get the edge color of the Figure rectangle.

get_facecolor()

Get the face color of the Figure rectangle.

get_figheight()

Return the figure height in inches.

get_figure()

Return the .Figure instance the artist belongs to.

get_figwidth()

Return the figure width in inches.

get_frameon()

Return the figure’s background patch visibility, i.e. whether the figure background will be drawn.

get_gid()

Return the group id.

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

get_picker()

Return the picking behavior of the artist.

get_rasterized()

Return whether the artist is to be rasterized.

get_size_inches()

Return the current size of the figure in inches.

get_sketch_params()

Return the sketch parameters for the artist.

get_snap()

Return the snap setting.

get_tight_layout()

Return whether .tight_layout is called when drawing.

get_tightbbox(renderer[, bbox_extra_artists])

Return a (tight) bounding box of the figure in inches.

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 figure bounding box in display space.

get_zorder()

Return the artist’s zorder.

ginput([n, timeout, show_clicks, mouse_add, …])

Blocking call to interact with a figure.

have_units()

Return True if units are set on any axis.

init_layoutbox()

Initialize the layoutbox for use in constrained_layout.

is_transform_set()

Return whether the Artist has an explicitly set transform.

legend(*args, **kwargs)

Place a legend on the figure.

pchanged()

Call all of the registered callbacks.

pick(mouseevent)

Process a pick event.

pickable()

Return whether the artist is pickable.

properties()

Return a dictionary of all the properties of the artist.

remove()

Remove the artist from the figure if possible.

remove_callback(oid)

Remove a callback based on its observer id.

savefig(fname, *[, transparent])

Save the current figure.

sca(a)

Set the current axes to be a and return a.

set(**kwargs)

A property batch setter.

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

Set the artist’s animation state.

set_canvas(canvas)

Set the canvas that contains the figure

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

Set whether constrained_layout is used upon drawing. If None, :rc:`figure.constrained_layout.use` value will be used.

set_constrained_layout_pads(**kwargs)

Set padding for constrained_layout.

set_contains(picker)

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

set_dpi(val)

Set the resolution of the figure in dots-per-inch.

set_edgecolor(color)

Set the edge color of the Figure rectangle.

set_facecolor(color)

Set the face color of the Figure rectangle.

set_figheight(val[, forward])

Set the height of the figure in inches.

set_figure(fig)

Set the .Figure instance the artist belongs to.

set_figwidth(val[, forward])

Set the width of the figure in inches.

set_frameon(b)

Set the figure’s background patch visibility, i.e. whether the figure background will be 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_path_effects(path_effects)

Set the path effects.

set_picker(picker)

Define the picking behavior of the artist.

set_rasterized(rasterized)

Force rasterized (bitmap) drawing in vector backend output.

set_size_inches(w[, h, forward])

Set the figure size in inches.

set_sketch_params([scale, length, randomness])

Sets the sketch parameters.

set_snap(snap)

Set the snapping behavior.

set_tight_layout(tight)

Set whether and how .tight_layout is called when drawing.

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

Set the zorder for the artist.

show([warn])

If using a GUI backend with pyplot, display the figure window.

subplot_mosaic(layout, *[, subplot_kw, …])

Build a layout of Axes based on ASCII art or nested lists.

subplots([nrows, ncols, sharex, sharey, …])

Add a set of subplots to this figure.

subplots_adjust([left, bottom, right, top, …])

Adjust the subplot layout parameters.

suptitle(t, **kwargs)

Add a centered title to the figure.

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

Add text to figure.

tight_layout([renderer, pad, h_pad, w_pad, rect])

Adjust the padding between and around subplots.

update(props)

Update this artist’s properties from the dict props.

update_from(other)

Copy properties from other to self.

waitforbuttonpress([timeout])

Blocking call to interact with the figure.

Attributes

axes

List of axes in the Figure.

dpi

The resolution in dots per inch.

frameon

Return the figure’s background patch visibility, i.e. whether the figure background will be drawn.

mouseover

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

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.

zorder