Skip to content

Commit e8b9ee3

Browse files
committed
Permit changing show_fonts() weight, style, stretch
1 parent 98209e8 commit e8b9ee3

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

proplot/styletools.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3705,7 +3705,10 @@ def show_cycles(*args, **kwargs):
37053705
return _draw_bars(names, **kwargs)
37063706

37073707

3708-
def show_fonts(*args, family=None, text=None, size=12):
3708+
def show_fonts(
3709+
*args, family=None, text=None,
3710+
size=12, weight='normal', style='normal', stretch='normal',
3711+
):
37093712
"""
37103713
Generate a table of fonts. If a glyph for a particular font is unavailable,
37113714
it is replaced with the "¤" dummy character.
@@ -3729,6 +3732,12 @@ def show_fonts(*args, family=None, text=None, size=12):
37293732
Greek letters, Arabic numerals, and some simple mathematical symbols.
37303733
size : float, optional
37313734
The font size in points.
3735+
weight : weight-spec, optional
3736+
The font weight.
3737+
style : style-spec, optional
3738+
The font style.
3739+
stretch : stretch-spec, optional
3740+
The font stretch.
37323741
"""
37333742
from . import subplots
37343743
import matplotlib.font_manager as mfonts
@@ -3799,7 +3808,8 @@ def show_fonts(*args, family=None, text=None, size=12):
37993808
ax.text(
38003809
0, 0.5, f'{font}:\n{text}',
38013810
fontfamily=font, fontsize=size,
3802-
weight='normal', ha='left', va='center'
3811+
stretch=stretch, style=style, weight=weight,
3812+
ha='left', va='center'
38033813
)
38043814
return fig
38053815

0 commit comments

Comments
 (0)