matplotlib 3.5.1

ParametersReturnsBackRef
get_metrics(self, font, font_class, sym, fontsize, dpi, math=True)

Parameters

font : str

One of the TeX font names: "tt", "it", "rm", "cal", "sf", "bf", "default", "regular", "bb", "frak", "scr". "default" and "regular" are synonyms and use the non-math font.

font_class : str

One of the TeX font names (as for font), but not "bb", "frak", or "scr". This is used to combine two font classes. The only supported combination currently is get_metrics("frak", "bf", ...) .

sym : str

A symbol in raw TeX form, e.g., "1", "x", or "\sigma".

fontsize : float

Font size in points.

dpi : float

Rendering dots-per-inch.

math : bool

Whether we are currently in math mode or not.

Returns

object

The returned object has the following attributes (all floats, except slanted):

  • advance: The advance distance (in points) of the glyph.

  • height: The height of the glyph in points.

  • width: The width of the glyph in points.

  • xmin, xmax, ymin, ymax: The ink rectangle of the glyph

  • iceberg: The distance from the baseline to the top of the glyph. (This corresponds to TeX's definition of "height".)

  • slanted: Whether the glyph should be considered as "slanted" (currently used for kerning sub/superscripts).

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

matplotlib._mathtext.Fonts.render_glyph matplotlib._mathtext.Fonts.get_kern

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /matplotlib/_mathtext.py#112
type: <class 'function'>
Commit: