onstove.ScaleBar#

class onstove.ScaleBar(style='single', size=1, extent=0.03, loc='upper left', ax=None, pad=0.4, borderpad=0.5, sep=2, prop=None, frameon=False, linekw={}, textprops={}, **kwargs)[source]#

Object used to create a scale bar based on an axes transform.

This makes use of the matplotlib.offsetbox.AnchoredOffsetbox object to render the scale.

Parameters:
style: str, default ‘single’

Graphic style of the scale, available options ‘single’ or ‘double’.

size: int, default 1

Length of bar in data units, this will match the units of the axes.

extent: float, default 0.03

Height of bar ends in axes fraction.

loc: str or int, default ‘upper left’

A location code, same as matplotlib’s legend, either: upper right, upper left, lower left, lower right, right, center left, center right, lower center, upper center or center.

ax: matplotlib.axes.Axes, optional

Object of type matplotlib.axes.Axes.

pad: float, default 0.4

Padding around the child as fraction of the fontsize.

borderpad: float, default 0.5

Padding between the offsetbox frame and the bbox_to_anchor.

sep: float, default 2

Separation between the scale bar and the units.

prop: matplotlib.font_manager.FontProperties, optional

This is only used as a reference for paddings. If not given, rcParams[“legend.fontsize”] (default: ‘medium’) is used.

frameon: bool, default False

Whether to draw a frame around the scale bar.

linekw: dict, optional

Style properties for the scale bar.

textprops: dict, optional

Font properties for the text.

**kwargs

All other parameters are passed on to OffsetBox.

Attributes:
axes

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

mouseover

Return whether this artist is 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.

Methods

add_callback(func)

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

contains(mouseevent)

Delegate the mouse event contains-check to the children.

convert_xunits(x)

Convert x using the unit type of the xaxis.

convert_yunits(y)

Convert y using the unit type of the yaxis.

draw(renderer)

Update the location of children if necessary and draw them to the given renderer.

findobj([match, include_self])

Find artist objects.

format_cursor_data(data)

Return a string representation of data.

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

Return the bbox of the offsetbox, ignoring parent offsets.

get_bbox_to_anchor()

Return the bbox that the box is anchored to.

get_child()

Return the child.

get_children()

Return the list of children.

get_clip_box()

Return the clipbox.

get_clip_on()

Return whether the artist uses clipping.

get_clip_path()

Return the clip path.

get_cursor_data(event)

Return the cursor data for a given event.

get_extent(renderer)

[Deprecated] Return a tuple width, height, xdescent, ydescent of the box.

get_extent_offsets(renderer)

[Deprecated] Update offset of the children and return the extent of the box.

get_figure()

Return the .Figure instance the artist belongs to.

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

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

get_offset(bbox, renderer)

Return the offset as a tuple (x, y).

get_picker()

Return the picking behavior of the artist.

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([renderer])

Like .Artist.get_window_extent, but includes any clipping.

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

Return a list of the visible child .Artists.

get_window_extent([renderer])

Get the artist's bounding box in display space.

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

set(*[, agg_filter, alpha, animated, ...])

Set multiple properties at once.

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 whether the artist is intended to be used in an animation.

set_bbox_to_anchor(bbox[, transform])

Set the bbox that the box is anchored to.

set_child(child)

Set the child to be anchored.

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

Set the .Figure for the .OffsetBox and all its children.

set_gid(gid)

Set the (group) id for the artist.

set_height(height)

Set the height of the box.

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

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

set_offset(xy)

Set the offset.

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 for vector graphics output.

set_sketch_params([scale, length, randomness])

Set the sketch parameters.

set_snap(snap)

Set the snapping behavior.

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

Set the width of the box.

set_zorder(level)

Set the zorder for the artist.

update(props)

Update this artist's properties from the dict props.

update_from(other)

Copy properties from other to self.

get_path_effects

update_frame