Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6e5183f

Browse files
committed
Add rcparam for figure label size and weight
1 parent3a994d2 commit6e5183f

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

‎lib/matplotlib/figure.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,10 @@ def _suplabels(self, t, info, **kwargs):
314314
verticalalignment, va : {'top', 'center', 'bottom', 'baseline'},\
315315
default: %(va)s
316316
The vertical alignment of the text relative to (*x*, *y*).
317-
fontsize, size : default: :rc:`figure.titlesize`
317+
fontsize, size : default: :rc:`figure.%(size)s`
318318
The font size of the text. See `.Text.set_size` for possible
319319
values.
320-
fontweight, weight : default: :rc:`figure.titleweight`
320+
fontweight, weight : default: :rc:`figure.%(weight)s`
321321
The font weight of the text. See `.Text.set_weight` for possible
322322
values.
323323
@@ -360,9 +360,9 @@ def _suplabels(self, t, info, **kwargs):
360360

361361
if'fontproperties'notinkwargs:
362362
if'fontsize'notinkwargsand'size'notinkwargs:
363-
kwargs['size']=mpl.rcParams['figure.titlesize']
363+
kwargs['size']=mpl.rcParams[info['size']]
364364
if'fontweight'notinkwargsand'weight'notinkwargs:
365-
kwargs['weight']=mpl.rcParams['figure.titleweight']
365+
kwargs['weight']=mpl.rcParams[info['weight']]
366366

367367
sup=self.text(x,y,t,**kwargs)
368368
ifsuplabisnotNone:
@@ -378,31 +378,36 @@ def _suplabels(self, t, info, **kwargs):
378378
returnsuplab
379379

380380
@docstring.Substitution(x0=0.5,y0=0.98,name='suptitle',ha='center',
381-
va='top')
381+
va='top',size='titlesize',weight='titleweight')
382382
@docstring.copy(_suplabels)
383383
defsuptitle(self,t,**kwargs):
384384
# docstring from _suplabels...
385385
info= {'name':'_suptitle','x0':0.5,'y0':0.98,
386-
'ha':'center','va':'top','rotation':0}
386+
'ha':'center','va':'top','rotation':0,
387+
'size':'figure.titlesize','weight':'figure.titleweight'}
387388
returnself._suplabels(t,info,**kwargs)
388389

389390
@docstring.Substitution(x0=0.5,y0=0.01,name='supxlabel',ha='center',
390-
va='bottom')
391+
va='bottom',size='labelsize',
392+
weight='labelweight')
391393
@docstring.copy(_suplabels)
392394
defsupxlabel(self,t,**kwargs):
393395
# docstring from _suplabels...
394396
info= {'name':'_supxlabel','x0':0.5,'y0':0.01,
395-
'ha':'center','va':'bottom','rotation':0}
397+
'ha':'center','va':'bottom','rotation':0,
398+
'size':'figure.labelsize','weight':'figure.labelweight'}
396399
returnself._suplabels(t,info,**kwargs)
397400

398401
@docstring.Substitution(x0=0.02,y0=0.5,name='supylabel',ha='left',
399-
va='center')
402+
va='center',size='labelsize',
403+
weight='labelweight')
400404
@docstring.copy(_suplabels)
401405
defsupylabel(self,t,**kwargs):
402406
# docstring from _suplabels...
403407
info= {'name':'_supylabel','x0':0.02,'y0':0.5,
404408
'ha':'left','va':'center','rotation':'vertical',
405-
'rotation_mode':'anchor'}
409+
'rotation_mode':'anchor',
410+
'size':'figure.labelsize','weight':'figure.labelweight'}
406411
returnself._suplabels(t,info,**kwargs)
407412

408413
defget_edgecolor(self):

‎lib/matplotlib/mpl-data/matplotlibrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,8 @@
546546
## See https://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure
547547
#figure.titlesize: large # size of the figure title (``Figure.suptitle()``)
548548
#figure.titleweight: normal # weight of the figure title
549+
#figure.labelsize: large # size of the figure label (``Figure.sup[x|y]label()``)
550+
#figure.labelweight: normal # weight of the figure label
549551
#figure.figsize: 6.4, 4.8 # figure size in inches
550552
#figure.dpi: 100 # figure dots per inch
551553
#figure.facecolor: white # figure face color

‎lib/matplotlib/mpl-data/stylelib/classic.mplstyle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ legend.edgecolor : inherit # legend edge color (when 'inherit' uses axes.e
307307
# See https://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure
308308
figure.titlesize : medium # size of the figure title
309309
figure.titleweight : normal # weight of the figure title
310+
figure.labelsize: medium # size of the figure label
311+
figure.labelweight: normal # weight of the figure label
310312
figure.figsize : 8, 6 # figure size in inches
311313
figure.dpi : 80 # figure dots per inch
312314
figure.facecolor : 0.75 # figure facecolor; 0.75 is scalar gray

‎lib/matplotlib/rcsetup.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,10 @@ def _convert_validator_spec(key, conv):
11161116
"figure.titlesize":validate_fontsize,
11171117
"figure.titleweight":validate_fontweight,
11181118

1119+
# figure labels
1120+
"figure.labelsize":validate_fontsize,
1121+
"figure.labelweight":validate_fontweight,
1122+
11191123
# figure size in inches: width by height
11201124
"figure.figsize":_listify_validator(validate_float,n=2),
11211125
"figure.dpi":validate_float,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp