Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 32293ed

Browse files
committed
Add axes.labelweight rcParam. Closes matplotlib#332.
1 parent b516ae0 commit 32293ed

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

lib/matplotlib/axis.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,8 @@ def _get_label(self):
15521552
# time by _update_label_positions)
15531553
label = mtext.Text(x=0.5, y=0,
15541554
fontproperties = font_manager.FontProperties(
1555-
size=rcParams['axes.labelsize']),
1555+
size=rcParams['axes.labelsize'],
1556+
weight=rcParams['axes.labelweight']),
15561557
color = rcParams['axes.labelcolor'],
15571558
verticalalignment='top',
15581559
horizontalalignment='center',
@@ -1809,7 +1810,8 @@ def _get_label(self):
18091810
label = mtext.Text(x=0, y=0.5,
18101811
# todo: get the label position
18111812
fontproperties=font_manager.FontProperties(
1812-
size=rcParams['axes.labelsize']),
1813+
size=rcParams['axes.labelsize'],
1814+
weight=rcParams['axes.labelweight']),
18131815
color = rcParams['axes.labelcolor'],
18141816
verticalalignment='center',
18151817
horizontalalignment='right',

lib/matplotlib/rcsetup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ def __call__(self, s):
441441
'axes.titlesize' : ['large', validate_fontsize], # fontsize of the axes title
442442
'axes.grid' : [False, validate_bool], # display grid or not
443443
'axes.labelsize' : ['medium', validate_fontsize], # fontsize of the x any y labels
444+
'axes.labelweight' : ['normal', str], # fontsize of the x any y labels
444445
'axes.labelcolor' : ['k', validate_color], # color of axis label
445446
'axes.formatter.limits' : [[-7, 7], validate_nseq_int(2)],
446447
# use scientific notation if log10

lib/mpl_toolkits/axisartist/axis_artist.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,9 @@ def _init_label(self, **kw):
13811381
rcParams['axes.labelsize'])
13821382
#labelcolor = kw.get("labelcolor",
13831383
# rcParams['axes.labelcolor'])
1384-
fontprops = font_manager.FontProperties(size=labelsize)
1384+
fontprops = font_manager.FontProperties(
1385+
size=labelsize,
1386+
weight=rcParams['axes.labelweight'])
13851387
textprops = dict(fontproperties = fontprops)
13861388
#color = labelcolor)
13871389

@@ -1407,7 +1409,9 @@ def _update_label(self, renderer):
14071409
if not self.label.get_visible():
14081410
return
14091411

1410-
fontprops = font_manager.FontProperties(size=rcParams['axes.labelsize'])
1412+
fontprops = font_manager.FontProperties(
1413+
size=rcParams['axes.labelsize'],
1414+
weight=rcParams['axes.labelweight'])
14111415

14121416
#pad_points = self.major_tick_pad
14131417

@@ -1450,7 +1454,9 @@ def _draw_label2(self, renderer):
14501454
if not self.label.get_visible():
14511455
return
14521456

1453-
fontprops = font_manager.FontProperties(size=rcParams['axes.labelsize'])
1457+
fontprops = font_manager.FontProperties(
1458+
size=rcParams['axes.labelsize'],
1459+
weight=rcParams['axes.labelweight'])
14541460

14551461
#pad_points = self.major_tick_pad
14561462

matplotlibrc.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ backend : %(backend)s
194194
#axes.grid : False # display grid or not
195195
#axes.titlesize : large # fontsize of the axes title
196196
#axes.labelsize : medium # fontsize of the x any y labels
197+
#axes.labelweight : normal # weight of the x and y labels
197198
#axes.labelcolor : black
198199
#axes.axisbelow : False # whether axis gridlines and ticks are below
199200
# the axes elements (lines, text, etc)

0 commit comments

Comments
 (0)