tephpy.plotting.logo#
Place the tephpy logo on a figure or an axes.
The masters under _static are byte-identical copies of the published brand
bundle (logo spec §3.2), kept that way by a drift guard in
tests/plotting/test_logo.py. Sizing is a height in inches and is
dpi-independent (logo spec §3.3); placement follows the legend vocabulary
(logo spec §3.4).
Functions#
|
Draw the tephpy logo on a figure or an axes. |
Module Contents#
- tephpy.plotting.logo.add_logo(target: matplotlib.figure.Figure | matplotlib.axes.Axes | None = None, *, form: str = 'lockup', size: str | float = 'small', theme: str = 'auto', loc: str | tuple[float, float] = 'lower left', pad: float | None = None, zorder: float | None = None, **kwargs: Any) matplotlib.offsetbox.AnnotationBbox[source]#
Draw the tephpy logo on a figure or an axes.
The logo is an
matplotlib.offsetbox.AnnotationBboxanchored in the target’s own fraction coordinates, so a figure target places it against the figure edges and an axes target against the axes edges, exactly asmatplotlib.axes.Axes.legend()does (logo spec §3.4). Its rendered height is the number of inches asked for whatever the figure dpi (logo spec §3.3).- Parameters:
- target
matplotlib.figure.Figureormatplotlib.axes.Axes, optional What to brand, and what the position is relative to.
Nonetakes the current figure.- form
str, optional Which mark to draw:
"lockup","stacked"or"icon".- size
strorfloat, optional A preset,
"small"or"large", or an explicit height in inches.- theme
str, optional Which variant to draw:
"auto","light"or"dark". The name is the background the logo is drawn on, so"dark"is the variant for a dark background."auto"reads the target’s facecolor.- loc
strortupleoffloat, optional A
matplotlib.axes.Axes.legend()placement string, or an(x, y)pair in the target’s fraction coordinates giving the logo’s lower-left corner.- pad
float, optional Points between the logo and the target’s edge.
NonetakesLOGO_PAD. Ignored when loc is a pair, but still validated:add_logo(ax, loc=(0.5, 0.5), pad=float("nan"))raises.- zorder
float, optional Draw order.
NonetakesLOGO_ZORDER, which is above lines, text and legends.- **kwargs
Any Passed through to
matplotlib.offsetbox.OffsetImage:alpha,filternorm,filterrad,interpolationandresample.
- target
- Returns:
matplotlib.offsetbox.AnnotationBboxThe artist, already added to the target, for restyling or removal.
- Raises:
TypeErrorIf target is neither a figure nor an axes, if loc is neither a placement string nor a pair of floats, if pad or zorder is not a real number (e.g., a list), or if a keyword is not a
matplotlib.offsetbox.OffsetImageoption.ValueErrorIf form, size, theme or loc names something that does not exist, if size is not a positive finite height, if a loc pair holds a non-finite coordinate, if pad or zorder is a string, or if pad or zorder is not finite.