Skip to content

Commit dcdd5a5

Browse files
committed
Rename font.small/font.large to text.labelsize/text.titlesize
1 parent 0655020 commit dcdd5a5

File tree

3 files changed

+33
-31
lines changed

3 files changed

+33
-31
lines changed

proplot/axes/plot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2812,7 +2812,7 @@ def cmap_changer(
28122812
text_kw[key] = labels_kw.pop(key)
28132813
labels_kw.setdefault('colors', colors)
28142814
labels_kw.setdefault('inline_spacing', 3)
2815-
labels_kw.setdefault('fontsize', rc['small'])
2815+
labels_kw.setdefault('fontsize', rc['text.labelsize'])
28162816
labs = cobj.clabel(fmt=fmt, **labels_kw)
28172817
for lab in labs:
28182818
lab.update(text_kw)
@@ -2825,7 +2825,7 @@ def cmap_changer(
28252825
obj.update_scalarmappable()
28262826

28272827
# Get text positions and colors
2828-
labels_kw_ = {'size': rc['small'], 'ha': 'center', 'va': 'center'}
2828+
labels_kw_ = {'size': rc['text.labelsize'], 'ha': 'center', 'va': 'center'}
28292829
labels_kw_.update(labels_kw)
28302830
array = obj.get_array()
28312831
paths = obj.get_paths()

proplot/internals/rcsetup.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
'geogrid.lonstep': ('grid.lonstep', '0.6'),
6161
'geogrid.rotatelabels': ('grid.rotatelabels', '0.6'),
6262
'share': ('subplots.share', '0.6'),
63-
'small': ('font.small', '0.6'),
64-
'large': ('font.large', '0.6'),
63+
'small': ('text.labelsize', '0.6'),
64+
'large': ('text.titlesize', '0.6'),
6565
'span': ('subplots.span', '0.6'),
6666
'tight': ('subplots.tight', '0.6'),
6767
'tick.labelpad': ('tick.pad', '0.6'),
@@ -402,26 +402,11 @@
402402
'The color of the background axes patch.'
403403
),
404404

405-
# Font setting
405+
# Font settings
406406
'font.name': (
407407
'sans-serif',
408408
"Alias for :rcraw:`font.family`. The default is ``'sans-serif'``."
409409
),
410-
'font.small': (
411-
'medium',
412-
'Meta setting that changes '
413-
':rcraw:`tick.labelsize`, :rcraw:`axes.labelsize`, :rcraw:`legend.fontsize`,'
414-
"and :rcraw:`grid.labelsize` simultaneously. Default is ``'medium'``, i.e. "
415-
'the value of :rcraw:`font.size`.' + _addendum_fonts
416-
),
417-
'font.large': (
418-
'med-large',
419-
'Meta setting that changes '
420-
':rcraw:`abc.size`, :rcraw:`title.size`, :rcraw:`suptitle.size`, '
421-
'and subplot label settings like :rcraw:`leftlabel.size` simultaneously. '
422-
"Default is ``'med-large'``, i.e. 1.1. times :rcraw:`font.size`."
423-
+ _addendum_fonts
424-
),
425410

426411
# Gridlines
427412
'grid': (
@@ -713,6 +698,23 @@
713698
'Figure title font weight.'
714699
),
715700

701+
# Text settings
702+
'text.labelsize': (
703+
'medium',
704+
'Meta setting that changes the label-like sizes '
705+
':rcraw:`tick.labelsize`, :rcraw:`axes.labelsize`, :rcraw:`legend.fontsize`,'
706+
"and :rcraw:`grid.labelsize`. Default is ``'medium'``, i.e. "
707+
'the value of :rcraw:`font.size`.' + _addendum_fonts
708+
),
709+
'text.titlesize': (
710+
'med-large',
711+
'Meta setting that changes the title-like sizes '
712+
':rcraw:`abc.size`, :rcraw:`title.size`, :rcraw:`suptitle.size`, '
713+
'and subplot label settings like :rcraw:`leftlabel.size`. '
714+
"Default is ``'med-large'``, i.e. 1.1. times :rcraw:`font.size`."
715+
+ _addendum_fonts
716+
),
717+
716718
# Tick settings
717719
'tick.color': (
718720
COLOR,
@@ -816,11 +818,11 @@
816818
'axes.edgecolor', 'axes.labelcolor',
817819
'tick.labelcolor', 'hatch.color', 'xtick.color', 'ytick.color'
818820
),
819-
'font.small': ( # the 'small' fonts
821+
'text.labelsize': ( # the 'small' fonts
820822
'tick.labelsize', 'xtick.labelsize', 'ytick.labelsize',
821823
'axes.labelsize', 'legend.fontsize', 'grid.labelsize'
822824
),
823-
'font.large': ( # the 'large' fonts
825+
'text.titlesize': ( # the 'large' fonts
824826
'abc.size', 'figure.titlesize',
825827
'axes.titlesize', 'suptitle.size', 'title.size',
826828
'leftlabel.size', 'toplabel.size',

proplot/utils.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -528,21 +528,21 @@ def units(value, dest='in', axes=None, figure=None, width=True):
528528
# NOTE: Delay font_manager import, because want to avoid rebuilding font
529529
# cache, which means import must come after TTFPATH added to environ
530530
# by register_fonts()!
531-
small = rcParams['font.size'] # must be absolute
532-
large = rcParams['axes.titlesize']
533-
if isinstance(large, str):
531+
fontsize_small = rcParams['font.size'] # must be absolute
532+
fontsize_large = rcParams['axes.titlesize']
533+
if isinstance(fontsize_large, str):
534534
import matplotlib.font_manager as mfonts
535535
# error will be raised somewhere else if string name is invalid!
536-
scale = mfonts.font_scalings.get(large, 1)
537-
large = small * scale
536+
scale = mfonts.font_scalings.get(fontsize_large, 1)
537+
fontsize_large = fontsize_small * scale
538538

539539
# Scales for converting physical units to inches
540540
unit_dict = UNIT_DICT.copy()
541541
unit_dict.update({
542-
'em': small / 72.0,
543-
'en': 0.5 * small / 72.0,
544-
'Em': large / 72.0,
545-
'En': 0.5 * large / 72.0,
542+
'em': fontsize_small / 72.0,
543+
'en': 0.5 * fontsize_small / 72.0,
544+
'Em': fontsize_large / 72.0,
545+
'En': 0.5 * fontsize_large / 72.0,
546546
})
547547

548548
# Scales for converting display units to inches

0 commit comments

Comments
 (0)