Last active
June 26, 2022 23:02
-
-
Save daenuprobst/30ef6bfc67d304aee5e4d7b5701119aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
from matplotlib.axes import Axes | |
from matplotlib import rcParams | |
def index_subplots( | |
axs: Axes, | |
font_size: float = 20, | |
font_weight: str = "bold", | |
font_family: str = rcParams["font.family"], | |
x: float = -0.1, | |
y: float = 1.1, | |
uppercase: bool = False, | |
prefix: str = "", | |
suffix: str = "", | |
offset: int = 0, | |
): | |
int_to_char_map = string.ascii_lowercase | |
if uppercase: | |
int_to_char_map = string.ascii_uppercase | |
for i, ax in enumerate(axs): | |
ax.text( | |
x, | |
y, | |
prefix + int_to_char_map[i + offset] + suffix, | |
transform=ax.transAxes, | |
size=font_size, | |
weight=font_weight, | |
fontfamily=font_family, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment