Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,9 @@ def _suplabels(self, t, info, **kwargs):
@_docstring.copy(_suplabels)
def suptitle(self, t, **kwargs):
# docstring from _suplabels...
info = {'name': '_suptitle', 'x0': 0.5, 'y0': 0.98,
'ha': 'center', 'va': 'top', 'rotation': 0,
info = {'name': '_suptitle', 'x0': 'figure.title_x',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand how x0 and y0 get turn from the rcParam names into actual values?

My guess is that this is related to the failures in the doc build

'y0': 'figure.title_y', 'ha': 'figure.title_ha',
'va': 'figure.title_va', 'rotation': 0,
'size': 'figure.titlesize', 'weight': 'figure.titleweight'}
return self._suplabels(t, info, **kwargs)

Expand Down
4 changes: 4 additions & 0 deletions lib/matplotlib/mpl-data/matplotlibrc
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,10 @@
## * FIGURE *
## ***************************************************************************
## See https://matplotlib.org/stable/api/figure_api.html#matplotlib.figure.Figure
#figure.title_x: 0.5
#figure.title_y: 0.98
#figure.title_ha: center
#figure.title_va: center
#figure.titlesize: large # size of the figure title (``Figure.suptitle()``)
#figure.titleweight: normal # weight of the figure title
#figure.labelsize: large # size of the figure label (``Figure.sup[x|y]label()``)
Expand Down
4 changes: 4 additions & 0 deletions lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,10 @@ def _convert_validator_spec(key, conv):
# figure title
"figure.titlesize": validate_fontsize,
"figure.titleweight": validate_fontweight,
"figure.title_x": validate_float,
"figure.title_y": validate_float,
"figure.title_ha": ["center", "left", "right"],
"figure.title_va": ["top", "center", "bottom", "baseline"],

# figure labels
"figure.labelsize": validate_fontsize,
Expand Down
28 changes: 28 additions & 0 deletions lib/matplotlib/tests/test_polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,3 +446,31 @@ def test_polar_log():

n = 100
ax.plot(np.linspace(0, 2 * np.pi, n), np.logspace(0, 2, n))


def test_polar_rc_params():
fig = plt.figure(figsize=(9, 3))
ax = fig.add_subplot(polar=True)

ax.set_rscale('log')
ax.set_rlim(1, 1000)

n = 100
ax.plot(np.linspace(0, 2 * np.pi, n), np.logspace(0, 2, n))

plt.subplot(132)
plt.scatter(["1", "2"], [3, 4])

# Control
fig.suptitle("First Title", x=0.1, y=0.2, ha="right", va="bottom",
weight='light', size=20)

# Test suptitle
with mpl.rc_context({'figure.title_x': 0.1,
'figure.title_y': 0.2,
'figure.title_ha': "right",
'figure.title_va': "bottom",
'figure.titleweight': 'light',
'figure.titlesize': 20
}):
fig.suptitle("First Title")