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

Skip to content

Commit 8f79706

Browse files
committed
ENH: rcparam for padding between axes and title
1 parent 7daf247 commit 8f79706

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,9 +1026,10 @@ def cla(self):
10261026
size=rcParams['axes.titlesize'],
10271027
weight=rcParams['axes.titleweight']
10281028
)
1029-
1029+
title_offset_points = rcParams['axes.titlepad']
10301030
self.titleOffsetTrans = mtransforms.ScaledTranslation(
1031-
0.0, 9.0 / 72.0, self.figure.dpi_scale_trans)
1031+
0.0, title_offset_points / 72.0,
1032+
self.figure.dpi_scale_trans)
10321033
self.title = mtext.Text(
10331034
x=0.5, y=1.0, text='',
10341035
fontproperties=props,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ axes.grid : False # display grid or not
177177
axes.grid.which : major
178178
axes.grid.axis : both
179179
axes.titlesize : large # fontsize of the axes title
180+
axes.titlepad : 5.0 # pad between axes and title in points
180181
axes.titleweight : normal # font weight for axes title
181182
axes.labelsize : medium # fontsize of the x any y labels
182183
axes.labelpad : 5.0 # space between label and axis

lib/matplotlib/rcsetup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,7 @@ def validate_hist_bins(s):
980980
'axes.titlesize': ['large', validate_fontsize], # fontsize of the
981981
# axes title
982982
'axes.titleweight': ['normal', six.text_type], # font weight of axes title
983+
'axes.titlepad': [9.0, validate_float], # pad from axes top to title in points
983984
'axes.grid': [False, validate_bool], # display grid or not
984985
'axes.grid.which': ['major', validate_axis_locator], # set wether the gid are by
985986
# default draw on 'major'

matplotlibrc.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ backend : $TEMPLATE_BACKEND
294294
#axes.linewidth : 1.0 # edge linewidth
295295
#axes.grid : False # display grid or not
296296
#axes.titlesize : large # fontsize of the axes title
297+
#axes.titlepad : 9.0 # pad between axes and title in points
297298
#axes.labelsize : medium # fontsize of the x any y labels
298299
#axes.labelpad : 5.0 # space between label and axis
299300
#axes.labelweight : normal # weight of the x and y labels

0 commit comments

Comments
 (0)