egttools.plotting.simplex2d.Circle

class Circle(xy, radius=5, **kwargs)[source]

Bases: Ellipse

A circle patch.

Create a true circle at center xy = (x, y) with given radius.

Unlike CirclePolygon which is a polygonal approximation, this uses Bezier splines and is much closer to a scale-free circle.

Valid keyword arguments are:

Properties:

agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: unknown animated: bool antialiased or aa: bool or None capstyle: .CapStyle or {‘butt’, ‘projecting’, ‘round’} clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None color: :mpltype:`color` edgecolor or ec: :mpltype:`color` or None edgegapcolor: :mpltype:`color` or None facecolor or fc: :mpltype:`color` or None figure: ~matplotlib.figure.Figure or ~matplotlib.figure.SubFigure fill: bool gid: str hatch: {‘/’, ‘\’, ‘|’, ‘-’, ‘+’, ‘x’, ‘o’, ‘O’, ‘.’, ‘*’} hatch_linewidth: unknown hatchcolor: :mpltype:`color` or ‘edge’ or None in_layout: bool joinstyle: .JoinStyle or {‘miter’, ‘round’, ‘bevel’} label: object linestyle or ls: {‘-’, ‘–’, ‘-.’, ‘:’, ‘’, …} or (offset, on-off-seq) linewidth or lw: float or None mouseover: bool path_effects: list of .AbstractPathEffect picker: None or bool or float or callable rasterized: bool sketch_params: (scale: float, length: float, randomness: float) snap: bool or None transform: ~matplotlib.transforms.Transform url: str visible: bool zorder: float

Methods

add_callback

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

contains

Test whether the mouse event occurred in the patch.

contains_point

Return whether the given point is inside the patch.

contains_points

Return whether the given points are inside the patch.

convert_xunits

Convert x using the unit type of the xaxis.

convert_yunits

Convert y using the unit type of the yaxis.

draw

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

findobj

Find artist objects.

format_cursor_data

Return a string representation of data.

get_aa

Alias for get_antialiased.

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_angle

Return the angle of the ellipse.

get_animated

Return whether the artist is animated.

get_antialiased

Return whether antialiasing is used for drawing.

get_capstyle

Return the capstyle.

get_center

Return the center of the ellipse.

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_co_vertices

Return the co-vertices coordinates of the ellipse.

get_corners

Return the corners of the ellipse bounding box.

get_cursor_data

Return the cursor data for a given event.

get_data_transform

Return the ~.transforms.Transform mapping data coordinates to physical coordinates.

get_ec

Alias for get_edgecolor.

get_edgecolor

Return the edge color.

get_edgegapcolor

Return the edge gap color.

get_extents

Return the Patch's axis-aligned extents as a ~.transforms.Bbox.

get_facecolor

Return the face color.

get_fc

Alias for get_facecolor.

get_figure

Return the .Figure or .SubFigure instance the artist belongs to.

get_fill

Return whether the patch is filled.

get_gid

Return the group id.

get_hatch

Return the hatching pattern.

get_hatch_linewidth

Return the hatch linewidth.

get_hatchcolor

Return the hatch color.

get_height

Return the height of the ellipse.

get_in_layout

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

get_joinstyle

Return the joinstyle.

get_label

Return the label used for this artist in the legend.

get_linestyle

Return the linestyle.

get_linewidth

Return the line width in points.

get_ls

Alias for get_linestyle.

get_lw

Alias for get_linewidth.

get_mouseover

Return whether this artist is queried for custom context information when the mouse cursor moves over it.

get_patch_transform

Return the ~.transforms.Transform instance mapping patch coordinates to data coordinates.

get_path

Return the path of the ellipse.

get_path_effects

get_picker

Return the picking behavior of the artist.

get_radius

Return the radius of the circle.

get_rasterized

Return whether the artist is to be rasterized.

get_sketch_params

Return the sketch parameters for the artist.

get_snap

Return the snap setting.

get_tightbbox

Get the artist's bounding box in display space, taking clipping into account.

get_transform

Return the ~.transforms.Transform applied to the Patch.

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_vertices

Return the vertices coordinates of the ellipse.

get_verts

Return a copy of the vertices used in this patch.

get_visible

Return the visibility.

get_width

Return the width of the ellipse.

get_window_extent

Get the artist's bounding box in display space, ignoring clipping.

get_zorder

Return the artist's zorder.

have_units

Return whether units are set on any axis.

is_transform_set

Return whether the Artist has an explicitly set transform.

pchanged

Call all of the registered callbacks.

pick

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

Remove a callback based on its observer id.

set

Set multiple properties at once.

set_aa

Alias for set_antialiased.

set_agg_filter

Set the agg filter.

set_alpha

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

set_angle

Set the angle of the ellipse.

set_animated

Set whether the artist is intended to be used in an animation.

set_antialiased

Set whether to use antialiased rendering.

set_capstyle

Set the .CapStyle.

set_center

Set the center of the ellipse.

set_clip_box

Set the artist's clip .Bbox.

set_clip_on

Set whether the artist uses clipping.

set_clip_path

Set the artist's clip path.

set_color

Set both the edgecolor and the facecolor.

set_ec

Alias for set_edgecolor.

set_edgecolor

Set the patch edge color.

set_edgegapcolor

Set a color to fill the gaps in the dashed edge style.

set_facecolor

Set the patch face color.

set_fc

Alias for set_facecolor.

set_figure

Set the .Figure or .SubFigure instance the artist belongs to.

set_fill

Set whether to fill the patch.

set_gid

Set the (group) id for the artist.

set_hatch

Set the hatching pattern.

set_hatch_linewidth

Set the hatch linewidth.

set_hatchcolor

Set the patch hatch color.

set_height

Set the height of the ellipse.

set_in_layout

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

set_joinstyle

Set the .JoinStyle.

set_label

Set a label that will be displayed in the legend.

set_linestyle

Set the patch linestyle.

set_linewidth

Set the patch linewidth in points.

set_ls

Alias for set_linestyle.

set_lw

Alias for set_linewidth.

set_mouseover

Set whether this artist is queried for custom context information when the mouse cursor moves over it.

set_path_effects

Set the path effects.

set_picker

Define the picking behavior of the artist.

set_radius

Set the radius of the circle.

set_rasterized

Force rasterized (bitmap) drawing for vector graphics output.

set_sketch_params

Set the sketch parameters.

set_snap

Set the snapping behavior.

set_transform

Set the artist transform.

set_url

Set the url for the artist.

set_visible

Set the artist's visibility.

set_width

Set the width of the ellipse.

set_zorder

Set the zorder for the artist.

update

[Discouraged] Update this artist's properties from the dictionary props.

update_from

Copy properties from other to self.

Attributes

angle

Return the angle of the ellipse.

axes

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

center

Return the center of the ellipse.

figure

The (Sub)Figure that the artist is on.

fill

Return whether the patch is filled.

height

Return the height of the ellipse.

mouseover

Return whether this artist is queried for custom context information when the mouse cursor moves over it.

radius

Return the radius of the circle.

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.

width

Return the width of the ellipse.

zorder

classmethod __init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__init__(xy, radius=5, **kwargs)[source]

Create a true circle at center xy = (x, y) with given radius.

Unlike CirclePolygon which is a polygonal approximation, this uses Bezier splines and is much closer to a scale-free circle.

Valid keyword arguments are:

Properties:

agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: unknown animated: bool antialiased or aa: bool or None capstyle: .CapStyle or {‘butt’, ‘projecting’, ‘round’} clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None color: :mpltype:`color` edgecolor or ec: :mpltype:`color` or None edgegapcolor: :mpltype:`color` or None facecolor or fc: :mpltype:`color` or None figure: ~matplotlib.figure.Figure or ~matplotlib.figure.SubFigure fill: bool gid: str hatch: {‘/’, ‘\’, ‘|’, ‘-’, ‘+’, ‘x’, ‘o’, ‘O’, ‘.’, ‘*’} hatch_linewidth: unknown hatchcolor: :mpltype:`color` or ‘edge’ or None in_layout: bool joinstyle: .JoinStyle or {‘miter’, ‘round’, ‘bevel’} label: object linestyle or ls: {‘-’, ‘–’, ‘-.’, ‘:’, ‘’, …} or (offset, on-off-seq) linewidth or lw: float or None mouseover: bool path_effects: list of .AbstractPathEffect picker: None or bool or float or callable rasterized: bool sketch_params: (scale: float, length: float, randomness: float) snap: bool or None transform: ~matplotlib.transforms.Transform url: str visible: bool zorder: float

__str__()[source]

Return str(self).

add_callback(func)

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

Parameters:

func (Callable[[Artist], Any]) –

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:

The observer id associated with the callback. This id can be used for removing the callback with .remove_callback later.

Return type:

int

See also

remove_callback

contains(mouseevent, radius=None)

Test whether the mouse event occurred in the patch.

Parameters:
  • mouseevent (MouseEvent) – Where the user clicked.

  • radius (float | None) –

    Additional margin on the patch in target coordinates of .Patch.get_transform. See .Path.contains_point for further details.

    If None, the default value depends on the state of the object:

    • If .Artist.get_picker is a number, the default is that value. This is so that picking works as expected.

    • Otherwise if the edge color has a non-zero alpha, the default is half of the linewidth. This is so that all the colored pixels are “in” the patch.

    • Finally, if the edge has 0 alpha, the default is 0. This is so that patches without a stroked edge do not have points outside of the filled region report as “in” due to an invisible edge.

Return type:

tuple[bool, dict[Any, Any]]

contains_point(point, radius=None)

Return whether the given point is inside the patch.

Parameters:
  • point (tuple[float, float]) – The point (x, y) to check, in target coordinates of .Patch.get_transform(). These are display coordinates for patches that are added to a figure or Axes.

  • radius (float | None) –

    Additional margin on the patch in target coordinates of .Patch.get_transform. See .Path.contains_point for further details.

    If None, the default value depends on the state of the object:

    • If .Artist.get_picker is a number, the default is that value. This is so that picking works as expected.

    • Otherwise if the edge color has a non-zero alpha, the default is half of the linewidth. This is so that all the colored pixels are “in” the patch.

    • Finally, if the edge has 0 alpha, the default is 0. This is so that patches without a stroked edge do not have points outside of the filled region report as “in” due to an invisible edge.

Return type:

bool

Notes

The proper use of this method depends on the transform of the patch. Isolated patches do not have a transform. In this case, the patch creation coordinates and the point coordinates match. The following example checks that the center of a circle is within the circle

>>> center = 0, 0
>>> c = Circle(center, radius=1)
>>> c.contains_point(center)
True

The convention of checking against the transformed patch stems from the fact that this method is predominantly used to check if display coordinates (e.g. from mouse events) are within the patch. If you want to do the above check with data coordinates, you have to properly transform them first:

>>> center = 0, 0
>>> c = Circle(center, radius=3)
>>> plt.gca().add_patch(c)
>>> transformed_interior_point = c.get_data_transform().transform((0, 2))
>>> c.contains_point(transformed_interior_point)
True
contains_points(points, radius=None)

Return whether the given points are inside the patch.

Parameters:
  • points (ArrayLike) – The points to check, in target coordinates of self.get_transform(). These are display coordinates for patches that are added to a figure or Axes. Columns contain x and y values.

  • radius (float | None) –

    Additional margin on the patch in target coordinates of .Patch.get_transform. See .Path.contains_point for further details.

    If None, the default value depends on the state of the object:

    • If .Artist.get_picker is a number, the default is that value. This is so that picking works as expected.

    • Otherwise if the edge color has a non-zero alpha, the default is half of the linewidth. This is so that all the colored pixels are “in” the patch.

    • Finally, if the edge has 0 alpha, the default is 0. This is so that patches without a stroked edge do not have points outside of the filled region report as “in” due to an invisible edge.

Return type:

ndarray

Notes

The proper use of this method depends on the transform of the patch. See the notes on .Patch.contains_point.

convert_xunits(x)

Convert x using the unit type of the xaxis.

If the artist is not contained in an Axes or if the xaxis does not have units, x itself is returned.

convert_yunits(y)

Convert y using the unit type of the yaxis.

If the artist is not contained in an Axes or if the yaxis does not have units, y itself is returned.

draw(renderer)

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:

renderer (~matplotlib.backend_bases.RendererBase subclass.)

Notes

This method is overridden in the Artist subclasses.

findobj(match=None, include_self=True)

Find artist objects.

Recursively find all .Artist instances contained in the artist.

Parameters:
  • match (None | Callable[[Artist], bool] | type[_T_Artist]) –

    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_self (bool) – Include self in the list to be checked for a match.

Return type:

list[Artist] | list[_T_Artist]

format_cursor_data(data)

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

Return type:

str

get_aa()

Alias for get_antialiased.

Return type:

bool

get_agg_filter()

Return filter function to be used for agg filter.

Return type:

Callable[[ArrayLike, float], tuple[ndarray, float, float]] | None

get_alpha()

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

Return type:

float | None

get_angle()

Return the angle of the ellipse.

Return type:

float

get_animated()

Return whether the artist is animated.

Return type:

bool

get_antialiased()

Return whether antialiasing is used for drawing.

Return type:

bool

get_capstyle()

Return the capstyle.

Return type:

Literal['butt', 'projecting', 'round']

get_center()

Return the center of the ellipse.

Return type:

float

get_children()

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

Return type:

list[Artist]

get_clip_box()

Return the clipbox.

Return type:

Bbox | None

get_clip_on()

Return whether the artist uses clipping.

Return type:

bool

get_clip_path()

Return the clip path.

Return type:

Patch | Path | TransformedPath | TransformedPatchPath | None

get_co_vertices()

Return the co-vertices coordinates of the ellipse.

The definition can be found here

Added in version 3.8.

Return type:

list[tuple[float, float]]

get_corners()

Return the corners of the ellipse bounding box.

The bounding box orientation is moving anti-clockwise from the lower left corner defined before rotation.

Return type:

ndarray

get_cursor_data(event)

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:

event (MouseEvent)

Return type:

Any

get_data_transform()

Return the ~.transforms.Transform mapping data coordinates to physical coordinates.

Return type:

Transform

get_ec()

Alias for get_edgecolor.

Return type:

tuple[float, float, float] | str | tuple[float, float, float, float] | tuple[tuple[float, float, float] | str, float] | tuple[tuple[float, float, float, float], float]

get_edgecolor()

Return the edge color.

Return type:

tuple[float, float, float] | str | tuple[float, float, float, float] | tuple[tuple[float, float, float] | str, float] | tuple[tuple[float, float, float, float], float]

get_edgegapcolor()

Return the edge gap color.

Added in version 3.11.

See also ~.Patch.set_edgegapcolor.

Return type:

tuple[float, float, float] | str | tuple[float, float, float, float] | tuple[tuple[float, float, float] | str, float] | tuple[tuple[float, float, float, float], float] | None

get_extents()

Return the Patch’s axis-aligned extents as a ~.transforms.Bbox.

Return type:

Bbox

get_facecolor()

Return the face color.

Return type:

tuple[float, float, float] | str | tuple[float, float, float, float] | tuple[tuple[float, float, float] | str, float] | tuple[tuple[float, float, float, float], float]

get_fc()

Alias for get_facecolor.

Return type:

tuple[float, float, float] | str | tuple[float, float, float, float] | tuple[tuple[float, float, float] | str, float] | tuple[tuple[float, float, float, float], float]

get_figure(root=False)

Return the .Figure or .SubFigure instance the artist belongs to.

Parameters:

root (Union[Literal[True], Literal[False], bool]) – If False, return the (Sub)Figure this artist is on. If True, return the root Figure for a nested tree of SubFigures.

Return type:

Figure | None | SubFigure

get_fill()

Return whether the patch is filled.

Return type:

bool

get_gid()

Return the group id.

Return type:

str | None

get_hatch()

Return the hatching pattern.

Return type:

str

get_hatch_linewidth()

Return the hatch linewidth.

Return type:

float

get_hatchcolor()

Return the hatch color.

Return type:

tuple[float, float, float] | str | tuple[float, float, float, float] | tuple[tuple[float, float, float] | str, float] | tuple[tuple[float, float, float, float], float]

get_height()

Return the height of the ellipse.

Return type:

float

get_in_layout()

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

E.g. constrainedlayout_guide, .Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight').

Return type:

bool

get_joinstyle()

Return the joinstyle.

Return type:

Literal['miter', 'round', 'bevel']

get_label()

Return the label used for this artist in the legend.

Return type:

object

get_linestyle()

Return the linestyle.

Return type:

Union[Literal['-', 'solid', '--', 'dashed', '-.', 'dashdot', ':', 'dotted', '', 'none', ' ', 'None'], tuple[float, Sequence[float]]]

get_linewidth()

Return the line width in points.

Return type:

float

get_ls()

Alias for get_linestyle.

Return type:

Union[Literal['-', 'solid', '--', 'dashed', '-.', 'dashdot', ':', 'dotted', '', 'none', ' ', 'None'], tuple[float, Sequence[float]]]

get_lw()

Alias for get_linewidth.

Return type:

float

get_mouseover()

Return whether this artist is queried for custom context information when the mouse cursor moves over it.

Return type:

bool

get_patch_transform()

Return the ~.transforms.Transform instance mapping patch coordinates to data coordinates.

For example, one may define a patch of a circle which represents a radius of 5 by providing coordinates for a unit circle, and a transform which scales the coordinates (the patch coordinate) by 5.

get_path()

Return the path of the ellipse.

get_path_effects()
Return type:

list[AbstractPathEffect]

get_picker()

Return the picking behavior of the artist.

The possible values are described in .Artist.set_picker.

See also

Artist.set_picker, Artist.pickable, Artist.pick

Return type:

None | bool | float | Callable[[Artist, MouseEvent], tuple[bool, dict[Any, Any]]]

get_radius()[source]

Return the radius of the circle.

Return type:

float

get_rasterized()

Return whether the artist is to be rasterized.

Return type:

bool

get_sketch_params()

Return the sketch parameters for the artist.

Returns:

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.

Return type:

tuple[float, float, float] | None

get_snap()

Return the snap setting.

See .set_snap for details.

Return type:

bool | None

get_tightbbox(renderer=None)

Get the artist’s bounding box in display space, taking clipping into account.

Parameters:

renderer (RendererBase | None) – Renderer used to draw the figure (i.e. fig.canvas.get_renderer()).

Returns:

The enclosing bounding box (in figure pixel coordinates), or None if clipping results in no intersection.

Return type:

Bbox | None

See also

Artist.get_window_extent

Get the artist bounding box, ignoring clipping.

get_transform()

Return the ~.transforms.Transform applied to the Patch.

Return type:

Transform

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.

Return type:

tuple[None, None] | tuple[Path, Transform]

get_url()

Return the url.

Return type:

str | None

get_vertices()

Return the vertices coordinates of the ellipse.

The definition can be found here

Added in version 3.8.

Return type:

list[tuple[float, float]]

get_verts()

Return a copy of the vertices used in this patch.

If the patch contains Bézier curves, the curves will be interpolated by line segments. To access the curves as curves, use get_path.

Return type:

ArrayLike

get_visible()

Return the visibility.

Return type:

bool

get_width()

Return the width of the ellipse.

Return type:

float

get_window_extent(renderer=None)

Get the artist’s bounding box in display space, ignoring clipping.

The bounding box’s width and height are non-negative.

Subclasses should override for inclusion in the bounding box “tight” calculation. Default is to return an empty bounding box at 0, 0.

Warning

The extent can change due to any changes in the transform stack, such as changing the Axes limits, the figure size, the canvas used (as is done when saving a figure), or the DPI.

Relying on a once-retrieved window extent can lead to unexpected behavior in various cases such as interactive figures being resized or moved to a screen with different dpi, or figures that look fine on screen render incorrectly when saved to file.

To get accurate results you may need to manually call ~.Figure.savefig or ~.Figure.draw_without_rendering to have Matplotlib compute the rendered size.

Parameters:

renderer (~matplotlib.backend_bases.RendererBase, optional) – Renderer used to draw the figure (i.e. fig.canvas.get_renderer()).

See also

Artist.get_tightbbox

Get the artist bounding box, taking clipping into account.

get_zorder()

Return the artist’s zorder.

Return type:

float

have_units()

Return whether units are set on any axis.

Return type:

bool

is_transform_set()

Return whether the Artist has an explicitly set transform.

This is True after .set_transform has been called.

Return type:

bool

pchanged()

Call all of the registered callbacks.

This function is triggered internally when a property is changed.

Return type:

None

pick(mouseevent)

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

Artist.set_picker, Artist.get_picker, Artist.pickable

Return type:

None

pickable()

Return whether the artist is pickable.

See also

Artist.set_picker, Artist.get_picker, Artist.pick

Return type:

bool

properties()

Return a dictionary of all the properties of the artist.

Return type:

dict[str, Any]

remove()

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 ~.axes.Axes.relim to update the Axes limits if desired.

Note: there is no support for removing the artist’s legend entry.

Return type:

None

remove_callback(oid)

Remove a callback based on its observer id.

See also

add_callback

Return type:

None

set(*, agg_filter=<UNSET>, alpha=<UNSET>, angle=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, center=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, edgegapcolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, hatch_linewidth=<UNSET>, hatchcolor=<UNSET>, height=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, radius=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, width=<UNSET>, zorder=<UNSET>)

Set multiple properties at once.

a.set(a=A, b=B, c=C)

is equivalent to

a.set_a(A)
a.set_b(B)
a.set_c(C)

In addition to the full property names, aliases are also supported, e.g. set(lw=2) is equivalent to set(linewidth=2), but it is an error to pass both simultaneously.

The order of the individual setter calls matches the order of parameters in set(). However, most properties do not depend on each other so that order is rarely relevant.

Supported properties are

Properties:

agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: float or None angle: float animated: bool antialiased or aa: bool or None capstyle: .CapStyle or {‘butt’, ‘projecting’, ‘round’} center: (float, float) clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None color: :mpltype:`color` edgecolor or ec: :mpltype:`color` or None edgegapcolor: :mpltype:`color` or None facecolor or fc: :mpltype:`color` or None figure: ~matplotlib.figure.Figure or ~matplotlib.figure.SubFigure fill: bool gid: str hatch: {‘/’, ‘\’, ‘|’, ‘-’, ‘+’, ‘x’, ‘o’, ‘O’, ‘.’, ‘*’} hatch_linewidth: unknown hatchcolor: :mpltype:`color` or ‘edge’ or None height: float in_layout: bool joinstyle: .JoinStyle or {‘miter’, ‘round’, ‘bevel’} label: object linestyle or ls: {‘-’, ‘–’, ‘-.’, ‘:’, ‘’, …} or (offset, on-off-seq) linewidth or lw: float or None mouseover: bool path_effects: list of .AbstractPathEffect picker: None or bool or float or callable radius: float rasterized: bool sketch_params: (scale: float, length: float, randomness: float) snap: bool or None transform: ~matplotlib.transforms.Transform url: str visible: bool width: float zorder: float

set_aa(aa)

Alias for set_antialiased.

Return type:

None

set_agg_filter(filter_func)

Set the agg filter.

Parameters:

filter_func (Callable[[ArrayLike, float], tuple[ndarray, float, float]] | None) –

A filter function, which takes a (m, n, depth) float array and a dpi value, and returns a (m, n, depth) array and two offsets from the bottom left corner of the image

Return type:

None

set_alpha(alpha)

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

Parameters:

alpha (float | None) – alpha must be within the 0-1 range, inclusive.

Return type:

None

set_angle(angle)

Set the angle of the ellipse.

Parameters:

angle (float)

Return type:

None

set_animated(b)

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 approach is used to speed up animations using blitting.

See also matplotlib.animation and blitting.

Parameters:

b (bool)

Return type:

None

set_antialiased(aa)

Set whether to use antialiased rendering.

Parameters:

aa (bool | None)

Return type:

None

set_capstyle(s)

Set the .CapStyle.

The default capstyle is ‘round’ for .FancyArrowPatch and ‘butt’ for all other patches.

Parameters:

s (Union[CapStyle, Literal['butt', 'projecting', 'round']])

Return type:

None

set_center(xy)

Set the center of the ellipse.

Parameters:

xy (tuple[float, float])

Return type:

None

set_clip_box(clipbox)

Set the artist’s clip .Bbox.

Parameters:

clipbox (BboxBase | None) – Will typically be created from a .TransformedBbox. For instance, TransformedBbox(Bbox([[0, 0], [1, 1]]), ax.transAxes) is the default clipping for an artist added to an Axes.

Return type:

None

set_clip_on(b)

Set whether the artist uses clipping.

When False, artists will be visible outside the Axes which can lead to unexpected results.

Parameters:

b (bool)

Return type:

None

set_clip_path(path, transform=None)

Set the artist’s clip path.

Parameters:
  • path (Patch | Path | TransformedPath | TransformedPatchPath | None) – The clip path. If given a .Path, transform must be provided as well. If None, a previously set clip path is removed.

  • transform (Transform | None) – Only used if path is a .Path, in which case the given .Path is converted to a .TransformedPath using transform.

Return type:

None

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 ~.Artist.set), a tuple (path, transform) is also accepted as a single positional parameter.

set_color(c)

Set both the edgecolor and the facecolor.

Parameters:

c (tuple[float, float, float] | str | tuple[float, float, float, float] | tuple[tuple[float, float, float] | str, float] | tuple[tuple[float, float, float, float], float] | None)

Return type:

None

See also

Patch.set_facecolor, Patch.set_edgecolor

set_ec(color)

Alias for set_edgecolor.

Return type:

None

set_edgecolor(color)

Set the patch edge color.

Parameters:

color (tuple[float, float, float] | str | tuple[float, float, float, float] | tuple[tuple[float, float, float] | str, float] | tuple[tuple[float, float, float, float], float] | None)

Return type:

None

set_edgegapcolor(edgegapcolor)

Set a color to fill the gaps in the dashed edge style.

Added in version 3.11.

Note

Striped edges are created by drawing two interleaved dashed lines. There can be overlaps between those two, which may result in artifacts when using transparency.

This functionality is experimental and may change.

Parameters:

edgegapcolor (tuple[float, float, float] | str | tuple[float, float, float, float] | tuple[tuple[float, float, float] | str, float] | tuple[tuple[float, float, float, float], float] | None) – The color with which to fill the gaps. If None, the gaps are unfilled.

Return type:

None

set_facecolor(color)

Set the patch face color.

Parameters:

color (tuple[float, float, float] | str | tuple[float, float, float, float] | tuple[tuple[float, float, float] | str, float] | tuple[tuple[float, float, float, float], float] | None)

Return type:

None

set_fc(color)

Alias for set_facecolor.

Return type:

None

set_figure(fig)

Set the .Figure or .SubFigure instance the artist belongs to.

Warning

This function should typically not be called by users.

This is a low-level API and only modifies the internal state of the Artist. Only modifying this is not enough and will typically lead to an inconsistent state, because the state of the figure has to be changed as well.

Users should typically instead call one of the high-level APIs, i.e. .Figure.add_artist or one of the Axes methods axes-api-adding-artists.

Parameters:

fig (Figure | SubFigure)

Return type:

None

set_fill(b)

Set whether to fill the patch.

Parameters:

b (bool)

Return type:

None

set_gid(gid)

Set the (group) id for the artist.

Parameters:

gid (str | None)

Return type:

None

set_hatch(hatch)

Set the hatching pattern.

hatch can be one of:

/   - diagonal hatching
\   - back diagonal
|   - vertical
-   - horizontal
+   - crossed
x   - crossed diagonal
o   - small circle
O   - large circle
.   - dots
*   - stars

Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.

In regular (non-raw) Python strings, backslashes must be doubled: '\\\\' and r'\\' are both a double back-diagonal hatch.

Parameters:

hatch (str)

Return type:

None

set_hatch_linewidth(lw)

Set the hatch linewidth.

Return type:

None

set_hatchcolor(color)

Set the patch hatch color.

Parameters:

color (Union[tuple[float, float, float], str, tuple[float, float, float, float], tuple[tuple[float, float, float] | str, float], tuple[tuple[float, float, float, float], float], Literal['edge'], None])

Return type:

None

set_height(height)

Set the height of the ellipse.

Parameters:

height (float)

Return type:

None

set_in_layout(in_layout)

Set if artist is to be included in layout calculations, E.g. constrainedlayout_guide, .Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight').

Parameters:

in_layout (bool)

Return type:

None

set_joinstyle(s)

Set the .JoinStyle.

The default joinstyle is ‘round’ for .FancyArrowPatch and ‘miter’ for all other patches.

Parameters:

s (Union[JoinStyle, Literal['miter', 'round', 'bevel']])

Return type:

None

set_label(s)

Set a label that will be displayed in the legend.

Parameters:

s (object) – s will be converted to a string by calling str.

Return type:

None

set_linestyle(ls)

Set the patch linestyle.

Parameters:

ls (Union[Literal['-', 'solid', '--', 'dashed', '-.', 'dashdot', ':', 'dotted', '', 'none', ' ', 'None'], tuple[float, Sequence[float]], None]) –

Possible values:

  • A string:

    linestyle

    description

    '-' or 'solid'

    solid line

    '--' or 'dashed'

    dashed line

    '-.' or 'dashdot'

    dash-dotted line

    ':' or 'dotted'

    dotted line

    '' or 'none' (discouraged: 'None', ' ')

    draw nothing

  • A tuple describing the start position and lengths of dashes and spaces:

    (offset, onoffseq)

    where

    • offset is a float specifying the offset (in points); i.e. how much is the dash pattern shifted.

    • onoffseq is a sequence of on and off ink in points. There can be arbitrary many pairs of on and off values.

    Example: The tuple (0, (10, 5, 1, 5)) means that the pattern starts at the beginning of the line. It draws a 10 point long dash, then a 5 point long space, then a 1 point long dash, followed by a 5 point long space, and then the pattern repeats.

For examples see /gallery/lines_bars_and_markers/linestyles.

Return type:

None

set_linewidth(w)

Set the patch linewidth in points.

Parameters:

w (float | None)

Return type:

None

set_ls(ls)

Alias for set_linestyle.

Return type:

None

set_lw(w)

Alias for set_linewidth.

Return type:

None

set_mouseover(mouseover)

Set whether this artist is queried for custom context information when the mouse cursor moves over it.

Parameters:

mouseover (bool)

Return type:

None

See also

get_cursor_data, ToolCursorPosition, NavigationToolbar2

set_path_effects(path_effects)

Set the path effects.

Parameters:

path_effects (list[AbstractPathEffect])

Return type:

None

set_picker(picker)

Define the picking behavior of the artist.

Parameters:

picker (None | bool | float | Callable[[Artist, MouseEvent], tuple[bool, dict[Any, Any]]]) –

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.

Return type:

None

set_radius(radius)[source]

Set the radius of the circle.

Parameters:

radius (float)

Return type:

None

set_rasterized(rasterized)

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 /gallery/misc/rasterization_demo.

Parameters:

rasterized (bool)

Return type:

None

set_sketch_params(scale=None, length=None, randomness=None)

Set the sketch parameters.

Parameters:
  • scale (float | None) – 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.

  • length (float | None) – The length of the wiggle along the line, in pixels (default 128.0)

  • randomness (float | None) –

    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.

Return type:

None

set_snap(snap)

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:

snap (bool | 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.

Return type:

None

set_transform(t)

Set the artist transform.

Parameters:

t (Transform | None)

Return type:

None

set_url(url)

Set the url for the artist.

Parameters:

url (str | None)

Return type:

None

set_visible(b)

Set the artist’s visibility.

Parameters:

b (bool)

Return type:

None

set_width(width)

Set the width of the ellipse.

Parameters:

width (float)

Return type:

None

set_zorder(level)

Set the zorder for the artist. Artists with lower zorder values are drawn first.

Parameters:

level (float)

Return type:

None

update(props)

[Discouraged] Update this artist’s properties from the dictionary props.

Discouraged

This method exists for historic reasons. Please use .Artist.set instead. artist.update(props) is nowadays almost identical to artist.set(**props) with the only difference that set will additionally check that a property is not specified multiple times through aliases.

Parameters:

props (dict[str, Any]) – Dictionary of properties (keys) and their new values.

Returns:

A list of return values from the configured setters.

Return type:

list[Any]

update_from(other)

Copy properties from other to self.

__annotations__ = {}
property angle

Return the angle of the ellipse.

property axes

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

property center

Return the center of the ellipse.

Setter accepts:

tuple[float, float]

property figure

The (Sub)Figure that the artist is on. For more control, use the get_figure method.

Setter accepts:

Figure | SubFigure

property fill

Return whether the patch is filled.

property height

Return the height of the ellipse.

property mouseover

Return whether this artist is queried for custom context information when the mouse cursor moves over it.

property radius

Return the radius of the circle.

property stale

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

property 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)
property width

Return the width of the ellipse.

zorder = 1