class craftutils.observation.image.Rectangle(matplotlib.patches.Patch)

A rectangle defined via an anchor point xy and its width and height.

The rectangle extends from xy[0] to xy[0] + width in x-direction and from xy[1] to xy[1] + height in y-direction.

:                +------------------+
:                |                  |
:              height               |
:                |                  |
:               (xy)---- width -----+

One may picture xy as the bottom left corner, but which corner xy is actually depends on the direction of the axis and the sign of width and height; e.g. xy would be the bottom right corner if the x-axis was inverted or if width was negative.

Public members

__str__()

Return str(self).

Rectangle(xy, width, height, *, angle=0.0, rotation_point='xy', **)

Parameters

xy(float, float)

The anchor point.

widthfloat

Rectangle width.

heightfloat

Rectangle height.

anglefloat, default: 0

Rotation in degrees anti-clockwise about the rotation point.

rotation_point{‘xy’, ‘center’, (number, number)}, default: ‘xy’

If 'xy', rotate around the anchor point. If 'center' rotate around the center. If 2-tuple of number, rotate around this coordinate.

get_path()

Return the vertices of the rectangle.

get_patch_transform()

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

get_x()

Return the left coordinate of the rectangle.

get_y()

Return the bottom coordinate of the rectangle.

get_xy()

Return the left and bottom coords of the rectangle as a tuple.

get_corners()

Return the corners of the rectangle, moving anti-clockwise from (x0, y0).

get_center()

Return the centre of the rectangle.

get_width()

Return the width of the rectangle.

get_height()

Return the height of the rectangle.

get_angle()

Get the rotation angle in degrees.

set_x(x)

Set the left coordinate of the rectangle.

set_y(y)

Set the bottom coordinate of the rectangle.

set_angle(angle)

Set the rotation angle in degrees.

set_xy(xy)

Set the left and bottom coordinates of the rectangle.

set_width(w)

Set the width of the rectangle.

set_height(h)

Set the height of the rectangle.

set_bounds(*args)

Set the bounds of the rectangle as left, bottom, width, height.

get_bbox()

Return the .Bbox.

set(*, agg_filter=<UNSET>, alpha=<UNSET>, angle=<UNSET>, ...)

Set multiple properties at once.

zorder = 1
get_verts()

Return a copy of the vertices used in this patch.

contains(mouseevent, radius=None)

Test whether the mouse event occurred in the patch.

contains_point(point, radius=None)

Return whether the given point is inside the patch.

contains_points(points, radius=None)

Return whether the given points are inside the patch.

update_from(other)

Copy properties from other to self.

get_extents()

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

get_transform()

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

get_data_transform()

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

get_antialiased()

Return whether antialiasing is used for drawing.

get_edgecolor()

Return the edge color.

get_facecolor()

Return the face color.

get_linewidth()

Return the line width in points.

get_linestyle()

Return the linestyle.

set_antialiased(aa)

Set whether to use antialiased rendering.

set_edgecolor(color)

Set the patch edge color.

set_facecolor(color)

Set the patch face color.

set_color(c)

Set both the edgecolor and the facecolor.

set_alpha(alpha)

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

set_linewidth(w)

Set the patch linewidth in points.

set_linestyle(ls)

Set the patch linestyle.

set_fill(b)

Set whether to fill the patch.

get_fill()

Return whether the patch is filled.

set_capstyle(s)

Set the .CapStyle.

get_capstyle()

Return the capstyle.

set_joinstyle(s)

Set the .JoinStyle.

get_joinstyle()

Return the joinstyle.

set_hatch(hatch)

Set the hatching pattern.

get_hatch()

Return the hatching pattern.

draw(renderer)

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

get_window_extent(renderer=None)

Get the artist’s bounding box in display space.

get_aa()

Alias for get_antialiased.

set_aa(aa)

Alias for set_antialiased.

get_ec()

Alias for get_edgecolor.

set_ec(color)

Alias for set_edgecolor.

get_fc()

Alias for get_facecolor.

set_fc(color)

Alias for set_facecolor.

get_ls()

Alias for get_linestyle.

set_ls(ls)

Alias for set_linestyle.

get_lw()

Alias for get_linewidth.

set_lw(w)

Alias for set_linewidth.

classmethod __init_subclass__()

This method is called when a class is subclassed.

remove()

Remove the artist from the figure if possible.

have_units()

Return whether units are set on any axis.

convert_xunits(x)

Convert x using the unit type of the xaxis.

convert_yunits(y)

Convert y using the unit type of the yaxis.

get_tightbbox(renderer=None)

Like .Artist.get_window_extent, but includes any clipping.

add_callback(func)

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

remove_callback(oid)

Remove a callback based on its observer id.

pchanged()

Call all of the registered callbacks.

is_transform_set()

Return whether the Artist has an explicitly set transform.

set_transform(t)

Set the artist transform.

get_children()

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

pickable()

Return whether the artist is pickable.

pick(mouseevent)

Process a pick event.

set_picker(picker)

Define the picking behavior of the artist.

get_picker()

Return the picking behavior of the artist.

get_url()

Return the url.

set_url(url)

Set the url for the artist.

get_gid()

Return the group id.

set_gid(gid)

Set the (group) id for the artist.

get_snap()

Return the snap setting.

set_snap(snap)

Set the snapping behavior.

get_sketch_params()

Return the sketch parameters for the artist.

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

Set the sketch parameters.

set_path_effects(path_effects)

Set the path effects.

get_path_effects()
get_figure()

Return the .Figure instance the artist belongs to.

set_figure(fig)

Set the .Figure instance the artist belongs to.

set_clip_box(clipbox)

Set the artist’s clip .Bbox.

set_clip_path(path, transform=None)

Set the artist’s clip path.

get_alpha()

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

get_visible()

Return the visibility.

get_animated()

Return whether the artist is animated.

get_in_layout()

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

get_clip_on()

Return whether the artist uses clipping.

get_clip_box()

Return the clipbox.

get_clip_path()

Return the clip path.

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.

set_clip_on(b)

Set whether the artist uses clipping.

get_rasterized()

Return whether the artist is to be rasterized.

set_rasterized(rasterized)

Force rasterized (bitmap) drawing for vector graphics output.

get_agg_filter()

Return filter function to be used for agg filter.

set_agg_filter(filter_func)

Set the agg filter.

set_visible(b)

Set the artist’s visibility.

set_animated(b)

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

set_in_layout(in_layout)

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

get_label()

Return the label used for this artist in the legend.

set_label(s)

Set a label that will be displayed in the legend.

get_zorder()

Return the artist’s zorder.

set_zorder(level)

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

properties()

Return a dictionary of all the properties of the artist.

update(props)

Update this artist’s properties from the dict props.

findobj(match=None, include_self=True)

Find artist objects.

get_cursor_data(event)

Return the cursor data for a given event.

format_cursor_data(data)

Return a string representation of data.

get_mouseover()

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

set_mouseover(mouseover)

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

Properties

property rotation_point

The rotation point of the patch.

property xy

Return the left and bottom coords of the rectangle as a tuple.

property fill

Return whether the patch is filled.

property axes

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

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.

property mouseover

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