Skip to main content
Ctrl+K
tephpy 0.1.0.dev116 documentation - Home tephpy 0.1.0.dev116 documentation - Home
  • Tutorials
  • How-To Guides
  • Explanation
  • Reference
  • Developer Guide
  • GitHub
  • Tutorials
  • How-To Guides
  • Explanation
  • Reference
  • Developer Guide
  • GitHub

Section Navigation

  • Configure tephpy From a File
  • Emphasise a Reference Isopleth
  • Add the tephpy Logo
  • How-To Guides
  • Add the tephpy Logo

Add the tephpy Logo#

add_logo() brands a figure or an axes in one call. It draws an matplotlib.offsetbox.AnnotationBbox, so the logo is a normal artist — returned for restyling, and removable.

On the Plot or Around It#

What you call it on decides what the position is relative to, exactly as legend() does. Pass the axes to place the logo inside the plotting box, or the figure to place it against the figure edges — in the margin, clear of the diagram:

import matplotlib.pyplot as plt

import tephpy  # registers the "tephigram" projection
from tephpy.plotting import add_logo

fig, ax = plt.subplots(subplot_kw={"projection": "tephigram"})
add_logo(ax, loc="lower right")
add_logo(fig, loc="upper left")

Calling it with no target at all brands the current figure, which is what you want at an interactive prompt:

add_logo()

Size and Form#

size is a height in inches, so the logo renders the same size on screen at 100 dpi and in a 600 dpi figure for print. The "small" and "large" presets are per form, because the three forms give the wordmark different shares of their height:

add_logo(ax, form="stacked", size="large")
add_logo(ax, form="icon", size=0.25)

Use form="lockup" — the default — where there is room for the wordmark, "stacked" where the space is taller than it is wide, and "icon" only where the mark is already recognised.

Light and Dark#

theme names the background the logo is drawn on, not the ink. The default, "auto", reads the target’s facecolor, so the right variant appears without being asked for on a white figure and under a dark style alike:

with plt.style.context("dark_background"):
    fig, ax = plt.subplots(subplot_kw={"projection": "tephigram"})
    add_logo(ax)  # draws the dark-background variant

Override it when you are compositing the figure onto something else:

add_logo(ax, theme="dark")

One case "auto" cannot get right: savefig(transparent=True) does not change any facecolor, it overrides alpha at draw time. "auto" still reads white and picks the light variant — correct for a figure destined for a white page, wrong for a dark one. Say which you meant:

add_logo(ax, theme="dark")
fig.savefig("sounding.png", transparent=True)

Exact Placement#

loc takes the legend() placement strings, with pad setting the gap in points from the edge. loc="best" is not among them: add_logo() does no collision detection, and silently guessing wrong is worse than saying so.

For a position no string names, pass an (x, y) pair in the target’s fraction coordinates. It places the logo’s lower-left corner and ignores pad:

add_logo(ax, loc=(0.42, 0.05))

Coordinates outside [0, 1] are allowed and put the logo outside the box, which is one way to caption a figure below its axes.

Restyling and Removal#

The returned artist is yours:

logo = add_logo(ax, alpha=0.6)
logo.set_zorder(0)  # behind the isopleths rather than over them
logo.remove()  # changed your mind

previous

Emphasise a Reference Isopleth

next

Explanation

On this page
  • On the Plot or Around It
  • Size and Form
  • Light and Dark
  • Exact Placement
  • Restyling and Removal
Show Source

© Copyright 2026, tephpy Contributors.

Created using Sphinx 9.1.0.

Built with the PyData Sphinx Theme 0.20.0.