Skip to content

Commit 983968e

Browse files
committed
Stop scaling font sizes on assignment
1 parent 20392f4 commit 983968e

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

proplot/axes/plot.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2074,7 +2074,11 @@ def text_wrapper(
20742074
fontsize = _not_none(fontsize, size)
20752075
fontfamily = _not_none(fontname, fontfamily, family)
20762076
if fontsize is not None:
2077-
kwargs['fontsize'] = units(fontsize, 'pt')
2077+
try:
2078+
rc._scale_font(fontsize) # *validate* but do not translate
2079+
except KeyError:
2080+
fontsize = units(fontsize, 'pt')
2081+
kwargs['fontsize'] = fontsize
20782082
if fontfamily is not None:
20792083
kwargs['fontfamily'] = fontfamily
20802084
if not transform:

proplot/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ def _get_synced_params(self, key, value):
387387
# TODO: Incorporate into more sophisticated validation system
388388
if any(REGEX_POINTS.match(_) for _ in keys):
389389
try:
390-
value = self._scale_font(value)
390+
self._scale_font(value) # *validate* but do not translate
391391
except KeyError:
392392
value = units(value, 'pt')
393393

proplot/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import re
66
import numpy as np
77
import matplotlib.colors as mcolors
8+
import matplotlib.font_manager as mfonts
89
from matplotlib import rcParams
910
from numbers import Number, Integral
1011
from .internals import ic # noqa: F401
@@ -581,8 +582,6 @@ def units(value, dest='in', axes=None, figure=None, width=True):
581582
fontsize_small = rcParams['font.size'] # must be absolute
582583
fontsize_large = rcParams['axes.titlesize']
583584
if isinstance(fontsize_large, str):
584-
import matplotlib.font_manager as mfonts
585-
# error will be raised somewhere else if string name is invalid!
586585
scale = mfonts.font_scalings.get(fontsize_large, 1)
587586
fontsize_large = fontsize_small * scale
588587

0 commit comments

Comments
 (0)