neuralib.plot.tools.AnchoredScaleBar
- class neuralib.plot.tools.AnchoredScaleBar[source]
Bases:
AnchoredOffsetbox- __init__(transform, sizex=0, sizey=0, labelx=None, labely=None, loc=4, pad=0.1, borderpad=0.1, sep=2, color='black', lw=1.5, color_txt='black', prop=None, **kwargs)[source]
Set of scale bars that match the size of the ticks of the plot.
Draws a horizontal and/or vertical bar with the size in data coordinates of the give axes. A label will be drawn underneath (center-aligned).
- Parameters:
transform (Transform) – Matplotlib Transform The coordinate frame (typically axes.transData)
sizex (float) – Width of x bar, in data units. 0 to omit.
sizey (float) – Width of y bar, in data units. 0 to omit.
labelx (str | None) – Labels for x bars; None to omit
labely (str | None) – Labels for y bars; None to omit
loc (int | str) – Position in containing axes.
pad (float) – Padding, in fraction of the legend font size (or prop).
borderpad
sep (int) – Separation between labels and bars in points.
color (str) – Bars color
lw (float) – Bars width
color_txt (str) – color
prop – Font property.
kwargs – additional arguments passed to base class constructor
Methods
__init__(transform[, sizex, sizey, labelx, ...])Set of scale bars that match the size of the ticks of the plot.
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_figure([root])Return the .Figure or .SubFigure instance the artist belongs to.
get_gid()Return the group id.
get_in_layout()Return boolean flag,
Trueif 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_path_effects()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_frame(bbox[, fontsize])update_from(other)Copy properties from other to self.
Attributes
axesThe ~.axes.Axes instance the artist resides in, or None.
codesfigureThe (Sub)Figure that the artist is on.
mouseoverReturn whether this artist is queried for custom context information when the mouse cursor moves over it.
staleWhether the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
sticky_edgesxandysticky edge lists for autoscaling.zorder- __init__(transform, sizex=0, sizey=0, labelx=None, labely=None, loc=4, pad=0.1, borderpad=0.1, sep=2, color='black', lw=1.5, color_txt='black', prop=None, **kwargs)[source]
Set of scale bars that match the size of the ticks of the plot.
Draws a horizontal and/or vertical bar with the size in data coordinates of the give axes. A label will be drawn underneath (center-aligned).
- Parameters:
transform (Transform) – Matplotlib Transform The coordinate frame (typically axes.transData)
sizex (float) – Width of x bar, in data units. 0 to omit.
sizey (float) – Width of y bar, in data units. 0 to omit.
labelx (str | None) – Labels for x bars; None to omit
labely (str | None) – Labels for y bars; None to omit
loc (int | str) – Position in containing axes.
pad (float) – Padding, in fraction of the legend font size (or prop).
borderpad
sep (int) – Separation between labels and bars in points.
color (str) – Bars color
lw (float) – Bars width
color_txt (str) – color
prop – Font property.
kwargs – additional arguments passed to base class constructor
- set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, bbox_to_anchor=<UNSET>, child=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, gid=<UNSET>, height=<UNSET>, in_layout=<UNSET>, label=<UNSET>, mouseover=<UNSET>, offset=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, width=<UNSET>, zorder=<UNSET>)
Set multiple properties at once.
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 animated: bool bbox_to_anchor: unknown child: unknown clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None figure: ~matplotlib.figure.Figure gid: str height: float in_layout: bool label: object mouseover: bool offset: (float, float) or callable 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 width: float zorder: float