pytools.viz.util.FittedText#

class pytools.viz.util.FittedText(*, x=0, y=0, width=None, height=None, text='', **kwargs)[source]#

Handle storing and drawing of text in window or data coordinates; only render text that does not exceed the given width and height in data coordinates.

Bases

Text

Parameters
  • x (Union[int, float]) – the x coordinate of the text

  • y (Union[int, float]) – the y coordinate of the text

  • width (Union[int, float, None]) – the maximum allowed width for this text, in data coordinates; if None, width is unrestricted

  • height (Union[int, float, None]) – the maximum allowed height for this text, in data coordinates; if None, height is unrestricted

  • text (str) – the text to be rendered

  • kwargs (Any) – additional keyword arguments of class matplotlib.text.Text

Method summary

add_callback

See matplotlib.artist.Artist.add_callback()

contains

See matplotlib.text.Text.contains()

convert_xunits

See matplotlib.artist.Artist.convert_xunits()

convert_yunits

See matplotlib.artist.Artist.convert_yunits()

draw

Draw the text if it is visible, and if it does not exceed the maximum width and height.

findobj

See matplotlib.artist.Artist.findobj()

format_cursor_data

See matplotlib.artist.Artist.format_cursor_data()

get_agg_filter

See matplotlib.artist.Artist.get_agg_filter()

get_alpha

See matplotlib.artist.Artist.get_alpha()

get_animated

See matplotlib.artist.Artist.get_animated()

get_antialiased

See matplotlib.text.Text.get_antialiased()

get_bbox_patch

See matplotlib.text.Text.get_bbox_patch()

get_c

See matplotlib.text.Text.get_color()

get_children

See matplotlib.artist.Artist.get_children()

get_clip_box

See matplotlib.artist.Artist.get_clip_box()

get_clip_on

See matplotlib.artist.Artist.get_clip_on()

get_clip_path

See matplotlib.artist.Artist.get_clip_path()

get_color

See matplotlib.text.Text.get_color()

get_cursor_data

See matplotlib.artist.Artist.get_cursor_data()

get_family

See matplotlib.text.Text.get_fontfamily()

get_figure

See matplotlib.artist.Artist.get_figure()

get_font

See matplotlib.text.Text.get_fontproperties()

get_font_properties

See matplotlib.text.Text.get_fontproperties()

get_fontfamily

See matplotlib.text.Text.get_fontfamily()

get_fontname

See matplotlib.text.Text.get_fontname()

get_fontproperties

See matplotlib.text.Text.get_fontproperties()

get_fontsize

See matplotlib.text.Text.get_fontsize()

get_fontstyle

See matplotlib.text.Text.get_fontstyle()

get_fontvariant

See matplotlib.text.Text.get_fontvariant()

get_fontweight

See matplotlib.text.Text.get_fontweight()

get_gid

See matplotlib.artist.Artist.get_gid()

get_ha

See matplotlib.text.Text.get_horizontalalignment()

get_height

Get the maximum allowed height for this text, in data coordinates.

get_horizontalalignment

See matplotlib.text.Text.get_horizontalalignment()

get_in_layout

See matplotlib.artist.Artist.get_in_layout()

get_label

See matplotlib.artist.Artist.get_label()

get_math_fontfamily

See matplotlib.text.Text.get_math_fontfamily()

get_mouseover

See matplotlib.artist.Artist.get_mouseover()

get_name

See matplotlib.text.Text.get_fontname()

get_parse_math

See matplotlib.text.Text.get_parse_math()

get_path_effects

See matplotlib.artist.Artist.get_path_effects()

get_picker

See matplotlib.artist.Artist.get_picker()

get_position

See matplotlib.text.Text.get_position()

get_rasterized

See matplotlib.artist.Artist.get_rasterized()

get_rotation

See matplotlib.text.Text.get_rotation()

get_rotation_mode

See matplotlib.text.Text.get_rotation_mode()

get_size

See matplotlib.text.Text.get_fontsize()

get_sketch_params

See matplotlib.artist.Artist.get_sketch_params()

get_snap

See matplotlib.artist.Artist.get_snap()

get_stretch

See matplotlib.text.Text.get_stretch()

get_style

See matplotlib.text.Text.get_fontstyle()

get_text

See matplotlib.text.Text.get_text()

get_tightbbox

See matplotlib.artist.Artist.get_tightbbox()

get_transform

See matplotlib.artist.Artist.get_transform()

get_transform_rotates_text

See matplotlib.text.Text.get_transform_rotates_text()

get_transformed_clip_path_and_affine

See matplotlib.artist.Artist.get_transformed_clip_path_and_affine()

get_unitless_position

See matplotlib.text.Text.get_unitless_position()

get_url

See matplotlib.artist.Artist.get_url()

get_usetex

See matplotlib.text.Text.get_usetex()

get_va

See matplotlib.text.Text.get_verticalalignment()

get_variant

See matplotlib.text.Text.get_fontvariant()

get_verticalalignment

See matplotlib.text.Text.get_verticalalignment()

get_visible

See matplotlib.artist.Artist.get_visible()

get_weight

See matplotlib.text.Text.get_fontweight()

get_width

Get the maximum allowed width for this text, in data coordinates.

get_window_extent

See matplotlib.text.Text.get_window_extent()

get_wrap

See matplotlib.text.Text.get_wrap()

get_zorder

See matplotlib.artist.Artist.get_zorder()

have_units

See matplotlib.artist.Artist.have_units()

is_transform_set

See matplotlib.artist.Artist.is_transform_set()

pchanged

See matplotlib.artist.Artist.pchanged()

pick

See matplotlib.artist.Artist.pick()

pickable

See matplotlib.artist.Artist.pickable()

properties

See matplotlib.artist.Artist.properties()

remove

See matplotlib.artist.Artist.remove()

remove_callback

See matplotlib.artist.Artist.remove_callback()

set

Set multiple properties.

set_agg_filter

See matplotlib.artist.Artist.set_agg_filter()

set_alpha

See matplotlib.artist.Artist.set_alpha()

set_animated

See matplotlib.artist.Artist.set_animated()

set_antialiased

See matplotlib.text.Text.set_antialiased()

set_backgroundcolor

See matplotlib.text.Text.set_backgroundcolor()

set_bbox

See matplotlib.text.Text.set_bbox()

set_c

See matplotlib.text.Text.set_color()

set_clip_box

See matplotlib.text.Text.set_clip_box()

set_clip_on

See matplotlib.text.Text.set_clip_on()

set_clip_path

See matplotlib.text.Text.set_clip_path()

set_color

See matplotlib.text.Text.set_color()

set_family

See matplotlib.text.Text.set_fontfamily()

set_figure

See matplotlib.artist.Artist.set_figure()

set_font

See matplotlib.text.Text.set_fontproperties()

set_font_properties

See matplotlib.text.Text.set_fontproperties()

set_fontfamily

See matplotlib.text.Text.set_fontfamily()

set_fontname

See matplotlib.text.Text.set_fontname()

set_fontproperties

See matplotlib.text.Text.set_fontproperties()

set_fontsize

See matplotlib.text.Text.set_fontsize()

set_fontstretch

See matplotlib.text.Text.set_fontstretch()

set_fontstyle

See matplotlib.text.Text.set_fontstyle()

set_fontvariant

See matplotlib.text.Text.set_fontvariant()

set_fontweight

See matplotlib.text.Text.set_fontweight()

set_gid

See matplotlib.artist.Artist.set_gid()

set_ha

See matplotlib.text.Text.set_horizontalalignment()

set_height

Set the maximum allowed height for this text, in data coordinates.

set_horizontalalignment

See matplotlib.text.Text.set_horizontalalignment()

set_in_layout

See matplotlib.artist.Artist.set_in_layout()

set_label

See matplotlib.artist.Artist.set_label()

set_linespacing

See matplotlib.text.Text.set_linespacing()

set_ma

See matplotlib.text.Text.set_multialignment()

set_math_fontfamily

See matplotlib.text.Text.set_math_fontfamily()

set_mouseover

See matplotlib.artist.Artist.set_mouseover()

set_multialignment

See matplotlib.text.Text.set_multialignment()

set_name

See matplotlib.text.Text.set_fontname()

set_parse_math

See matplotlib.text.Text.set_parse_math()

set_path_effects

See matplotlib.artist.Artist.set_path_effects()

set_picker

See matplotlib.artist.Artist.set_picker()

set_position

See matplotlib.text.Text.set_position()

set_rasterized

See matplotlib.artist.Artist.set_rasterized()

set_rotation

See matplotlib.text.Text.set_rotation()

set_rotation_mode

See matplotlib.text.Text.set_rotation_mode()

set_size

See matplotlib.text.Text.set_fontsize()

set_sketch_params

See matplotlib.artist.Artist.set_sketch_params()

set_snap

See matplotlib.artist.Artist.set_snap()

set_stretch

See matplotlib.text.Text.set_fontstretch()

set_style

See matplotlib.text.Text.set_fontstyle()

set_text

See matplotlib.text.Text.set_text()

set_transform

See matplotlib.artist.Artist.set_transform()

set_transform_rotates_text

See matplotlib.text.Text.set_transform_rotates_text()

set_url

See matplotlib.artist.Artist.set_url()

set_usetex

See matplotlib.text.Text.set_usetex()

set_va

See matplotlib.text.Text.set_verticalalignment()

set_variant

See matplotlib.text.Text.set_fontvariant()

set_verticalalignment

See matplotlib.text.Text.set_verticalalignment()

set_visible

See matplotlib.artist.Artist.set_visible()

set_weight

See matplotlib.text.Text.set_fontweight()

set_width

Set the maximum allowed width for this text, in data coordinates.

set_wrap

See matplotlib.text.Text.set_wrap()

set_x

See matplotlib.text.Text.set_x()

set_y

See matplotlib.text.Text.set_y()

set_zorder

See matplotlib.artist.Artist.set_zorder()

update

See matplotlib.text.Text.update()

update_bbox_position_size

See matplotlib.text.Text.update_bbox_position_size()

update_from

See matplotlib.text.Text.update_from()

Attribute summary

axes

See matplotlib.artist.Artist.axes

mouseover

See matplotlib.artist.Artist.get_mouseover

stale

See matplotlib.artist.Artist.stale

sticky_edges

See matplotlib.artist.Artist.sticky_edges

zorder

Definitions

add_callback(func)#

See matplotlib.artist.Artist.add_callback()

contains(mouseevent)#

See matplotlib.text.Text.contains()

convert_xunits(x)#

See matplotlib.artist.Artist.convert_xunits()

convert_yunits(y)#

See matplotlib.artist.Artist.convert_yunits()

draw(renderer)[source]#

Draw the text if it is visible, and if it does not exceed the maximum width and height.

See also draw().

Parameters

renderer (RendererBase) – the renderer used for drawing

Return type

None

findobj(match=None, include_self=True)#

See matplotlib.artist.Artist.findobj()

format_cursor_data(data)#

See matplotlib.artist.Artist.format_cursor_data()

get_agg_filter()#

See matplotlib.artist.Artist.get_agg_filter()

get_alpha()#

See matplotlib.artist.Artist.get_alpha()

get_animated()#

See matplotlib.artist.Artist.get_animated()

get_antialiased()#

See matplotlib.text.Text.get_antialiased()

get_bbox_patch()#

See matplotlib.text.Text.get_bbox_patch()

get_c()#

See matplotlib.text.Text.get_color()

get_children()#

See matplotlib.artist.Artist.get_children()

get_clip_box()#

See matplotlib.artist.Artist.get_clip_box()

get_clip_on()#

See matplotlib.artist.Artist.get_clip_on()

get_clip_path()#

See matplotlib.artist.Artist.get_clip_path()

get_color()#

See matplotlib.text.Text.get_color()

get_cursor_data(event)#

See matplotlib.artist.Artist.get_cursor_data()

get_family()#

See matplotlib.text.Text.get_fontfamily()

get_figure()#

See matplotlib.artist.Artist.get_figure()

get_font()#

See matplotlib.text.Text.get_fontproperties()

get_font_properties()#

See matplotlib.text.Text.get_fontproperties()

get_fontfamily()#

See matplotlib.text.Text.get_fontfamily()

get_fontname()#

See matplotlib.text.Text.get_fontname()

get_fontproperties()#

See matplotlib.text.Text.get_fontproperties()

get_fontsize()#

See matplotlib.text.Text.get_fontsize()

get_fontstyle()#

See matplotlib.text.Text.get_fontstyle()

get_fontvariant()#

See matplotlib.text.Text.get_fontvariant()

get_fontweight()#

See matplotlib.text.Text.get_fontweight()

get_gid()#

See matplotlib.artist.Artist.get_gid()

get_ha()#

See matplotlib.text.Text.get_horizontalalignment()

get_height()[source]#

Get the maximum allowed height for this text, in data coordinates.

Return type

Union[int, float, None]

Returns

the maximum allowed height; None if height is unrestricted

get_horizontalalignment()#

See matplotlib.text.Text.get_horizontalalignment()

get_in_layout()#

See matplotlib.artist.Artist.get_in_layout()

get_label()#

See matplotlib.artist.Artist.get_label()

get_math_fontfamily()#

See matplotlib.text.Text.get_math_fontfamily()

get_mouseover()#

See matplotlib.artist.Artist.get_mouseover()

get_name()#

See matplotlib.text.Text.get_fontname()

get_parse_math()#

See matplotlib.text.Text.get_parse_math()

get_picker()#

See matplotlib.artist.Artist.get_picker()

get_position()#

See matplotlib.text.Text.get_position()

get_rasterized()#

See matplotlib.artist.Artist.get_rasterized()

get_rotation()#

See matplotlib.text.Text.get_rotation()

get_rotation_mode()#

See matplotlib.text.Text.get_rotation_mode()

get_size()#

See matplotlib.text.Text.get_fontsize()

get_sketch_params()#

See matplotlib.artist.Artist.get_sketch_params()

get_snap()#

See matplotlib.artist.Artist.get_snap()

get_stretch()#

See matplotlib.text.Text.get_stretch()

get_style()#

See matplotlib.text.Text.get_fontstyle()

get_text()#

See matplotlib.text.Text.get_text()

get_tightbbox(renderer=None)#

See matplotlib.artist.Artist.get_tightbbox()

get_transform()#

See matplotlib.artist.Artist.get_transform()

get_transform_rotates_text()#

See matplotlib.text.Text.get_transform_rotates_text()

get_transformed_clip_path_and_affine()#

See matplotlib.artist.Artist.get_transformed_clip_path_and_affine()

get_unitless_position()#

See matplotlib.text.Text.get_unitless_position()

get_url()#

See matplotlib.artist.Artist.get_url()

get_usetex()#

See matplotlib.text.Text.get_usetex()

get_va()#

See matplotlib.text.Text.get_verticalalignment()

get_variant()#

See matplotlib.text.Text.get_fontvariant()

get_verticalalignment()#

See matplotlib.text.Text.get_verticalalignment()

get_visible()#

See matplotlib.artist.Artist.get_visible()

get_weight()#

See matplotlib.text.Text.get_fontweight()

get_width()[source]#

Get the maximum allowed width for this text, in data coordinates.

Return type

Union[int, float, None]

Returns

the maximum allowed width; None if width is unrestricted

get_window_extent(renderer=None, dpi=None)#

See matplotlib.text.Text.get_window_extent()

get_wrap()#

See matplotlib.text.Text.get_wrap()

get_zorder()#

See matplotlib.artist.Artist.get_zorder()

have_units()#

See matplotlib.artist.Artist.have_units()

is_transform_set()#

See matplotlib.artist.Artist.is_transform_set()

pchanged()#

See matplotlib.artist.Artist.pchanged()

pick(mouseevent)#

See matplotlib.artist.Artist.pick()

pickable()#

See matplotlib.artist.Artist.pickable()

properties()#

See matplotlib.artist.Artist.properties()

remove()#

See matplotlib.artist.Artist.remove()

remove_callback(oid)#

See matplotlib.artist.Artist.remove_callback()

set(**kwargs)[source]#

Set multiple properties.

Parameters

kwargs (Any) – the properties to set

Return type

None

set_agg_filter(filter_func)#

See matplotlib.artist.Artist.set_agg_filter()

set_alpha(alpha)#

See matplotlib.artist.Artist.set_alpha()

set_animated(b)#

See matplotlib.artist.Artist.set_animated()

set_antialiased(antialiased)#

See matplotlib.text.Text.set_antialiased()

set_backgroundcolor(color)#

See matplotlib.text.Text.set_backgroundcolor()

set_bbox(rectprops)#

See matplotlib.text.Text.set_bbox()

set_c(color)#

See matplotlib.text.Text.set_color()

set_clip_box(clipbox)#

See matplotlib.text.Text.set_clip_box()

set_clip_on(b)#

See matplotlib.text.Text.set_clip_on()

set_clip_path(path, transform=None)#

See matplotlib.text.Text.set_clip_path()

set_color(color)#

See matplotlib.text.Text.set_color()

set_family(fontname)#

See matplotlib.text.Text.set_fontfamily()

set_figure(fig)#

See matplotlib.artist.Artist.set_figure()

set_font(fp)#

See matplotlib.text.Text.set_fontproperties()

set_font_properties(fp)#

See matplotlib.text.Text.set_fontproperties()

set_fontfamily(fontname)#

See matplotlib.text.Text.set_fontfamily()

set_fontname(fontname)#

See matplotlib.text.Text.set_fontname()

set_fontproperties(fp)#

See matplotlib.text.Text.set_fontproperties()

set_fontsize(fontsize)#

See matplotlib.text.Text.set_fontsize()

set_fontstretch(stretch)#

See matplotlib.text.Text.set_fontstretch()

set_fontstyle(fontstyle)#

See matplotlib.text.Text.set_fontstyle()

set_fontvariant(variant)#

See matplotlib.text.Text.set_fontvariant()

set_fontweight(weight)#

See matplotlib.text.Text.set_fontweight()

set_gid(gid)#

See matplotlib.artist.Artist.set_gid()

set_ha(align)#

See matplotlib.text.Text.set_horizontalalignment()

set_height(height)[source]#

Set the maximum allowed height for this text, in data coordinates.

Parameters

height (Union[int, float, None]) – the maximum allowed height; None if height is unrestricted

Return type

None

set_horizontalalignment(align)#

See matplotlib.text.Text.set_horizontalalignment()

set_in_layout(in_layout)#

See matplotlib.artist.Artist.set_in_layout()

set_label(s)#

See matplotlib.artist.Artist.set_label()

set_linespacing(spacing)#

See matplotlib.text.Text.set_linespacing()

set_ma(align)#

See matplotlib.text.Text.set_multialignment()

set_math_fontfamily(fontfamily)#

See matplotlib.text.Text.set_math_fontfamily()

set_mouseover(mouseover)#

See matplotlib.artist.Artist.set_mouseover()

set_multialignment(align)#

See matplotlib.text.Text.set_multialignment()

set_name(fontname)#

See matplotlib.text.Text.set_fontname()

set_parse_math(parse_math)#

See matplotlib.text.Text.set_parse_math()

set_path_effects(path_effects)#

See matplotlib.artist.Artist.set_path_effects()

set_picker(picker)#

See matplotlib.artist.Artist.set_picker()

set_position(xy)#

See matplotlib.text.Text.set_position()

set_rasterized(rasterized)#

See matplotlib.artist.Artist.set_rasterized()

set_rotation(s)#

See matplotlib.text.Text.set_rotation()

set_rotation_mode(m)#

See matplotlib.text.Text.set_rotation_mode()

set_size(fontsize)#

See matplotlib.text.Text.set_fontsize()

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

See matplotlib.artist.Artist.set_sketch_params()

set_snap(snap)#

See matplotlib.artist.Artist.set_snap()

set_stretch(stretch)#

See matplotlib.text.Text.set_fontstretch()

set_style(fontstyle)#

See matplotlib.text.Text.set_fontstyle()

set_text(s)#

See matplotlib.text.Text.set_text()

set_transform(t)#

See matplotlib.artist.Artist.set_transform()

set_transform_rotates_text(t)#

See matplotlib.text.Text.set_transform_rotates_text()

set_url(url)#

See matplotlib.artist.Artist.set_url()

set_usetex(usetex)#

See matplotlib.text.Text.set_usetex()

set_va(align)#

See matplotlib.text.Text.set_verticalalignment()

set_variant(variant)#

See matplotlib.text.Text.set_fontvariant()

set_verticalalignment(align)#

See matplotlib.text.Text.set_verticalalignment()

set_visible(b)#

See matplotlib.artist.Artist.set_visible()

set_weight(weight)#

See matplotlib.text.Text.set_fontweight()

set_width(width)[source]#

Set the maximum allowed width for this text, in data coordinates.

Parameters

width (Union[int, float, None]) – the maximum allowed width; None if width is unrestricted

Return type

None

set_wrap(wrap)#

See matplotlib.text.Text.set_wrap()

set_x(x)#

See matplotlib.text.Text.set_x()

set_y(y)#

See matplotlib.text.Text.set_y()

set_zorder(level)#

See matplotlib.artist.Artist.set_zorder()

update(kwargs)#

See matplotlib.text.Text.update()

update_bbox_position_size(renderer)#

See matplotlib.text.Text.update_bbox_position_size()

update_from(other)#

See matplotlib.text.Text.update_from()

property axes#

See matplotlib.artist.Artist.axes

property mouseover#

See matplotlib.artist.Artist.get_mouseover

property stale#

See matplotlib.artist.Artist.stale

property sticky_edges#

See matplotlib.artist.Artist.sticky_edges