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

Skip to content

Commit c424d17

Browse files
committed
Merge pull request #2574 from adrn/titleweight
Add axes.titleweight as an rc param
2 parents 40c263b + 1e55a3c commit c424d17

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ def set_title(self, label, fontdict=None, loc="center", **kwargs):
108108
the default `fontdict` is::
109109
110110
{'fontsize': rcParams['axes.titlesize'],
111+
'fontweight' : rcParams['axes.titleweight'],
111112
'verticalalignment': 'baseline',
112113
'horizontalalignment': loc}
113114
@@ -133,6 +134,7 @@ def set_title(self, label, fontdict=None, loc="center", **kwargs):
133134
raise ValueError("'%s' is not a valid location" % loc)
134135
default = {
135136
'fontsize': rcParams['axes.titlesize'],
137+
'fontweight': rcParams['axes.titleweight'],
136138
'verticalalignment': 'baseline',
137139
'horizontalalignment': loc.lower()}
138140
title.set_text(label)

lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,8 @@ def cla(self):
895895
self.containers = []
896896

897897
self.grid(self._gridOn, which=rcParams['axes.grid.which'])
898-
props = font_manager.FontProperties(size=rcParams['axes.titlesize'])
898+
props = font_manager.FontProperties(size=rcParams['axes.titlesize'],
899+
weight=rcParams['axes.titleweight'])
899900

900901
self.titleOffsetTrans = mtransforms.ScaledTranslation(
901902
0.0, 5.0 / 72.0, self.figure.dpi_scale_trans)

lib/matplotlib/pyplot.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -794,16 +794,16 @@ def gca(**kwargs):
794794
"""
795795
Return the current :class:`~matplotlib.axes.Axes` instance on the
796796
current figure matching the given keyword args, or create one.
797-
797+
798798
Examples
799799
---------
800800
To get the the current polar axes on the current figure::
801-
801+
802802
plt.gca(projection='polar')
803-
803+
804804
If the current axes doesn't exist, or isn't a polar one, the appropriate
805805
axes will be created and then returned.
806-
806+
807807
See Also
808808
--------
809809
matplotlib.figure.Figure.gca : The figure's gca method.
@@ -1295,6 +1295,7 @@ def title(s, *args, **kwargs):
12951295
A dictionary controlling the appearance of the title text,
12961296
the default `fontdict` is:
12971297
{'fontsize': rcParams['axes.titlesize'],
1298+
'fontweight' : rcParams['axes.titleweight'],
12981299
'verticalalignment': 'baseline',
12991300
'horizontalalignment': loc}
13001301
loc : {'center', 'left', 'right'}, str, optional

lib/matplotlib/rcsetup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ def __call__(self, s):
576576
'axes.linewidth': [1.0, validate_float], # edge linewidth
577577
'axes.titlesize': ['large', validate_fontsize], # fontsize of the
578578
# axes title
579+
'axes.titleweight': ['normal', six.text_type], # font weight of axes title
579580
'axes.grid': [False, validate_bool], # display grid or not
580581
'axes.grid.which': ['major', validate_axis_locator], # set wether the gid are by
581582
# default draw on 'major'

0 commit comments

Comments
 (0)