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

Skip to content

Commit b3ee53d

Browse files
committed
ENH: rcparam for padding between axes and title
1 parent e24d5dc commit b3ee53d

4 files changed

Lines changed: 6 additions & 2 deletions

File tree

lib/matplotlib/axes/_base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,9 +1046,10 @@ def cla(self):
10461046
size=rcParams['axes.titlesize'],
10471047
weight=rcParams['axes.titleweight']
10481048
)
1049-
1049+
title_offset_points = rcParams['axes.titlepad']
10501050
self.titleOffsetTrans = mtransforms.ScaledTranslation(
1051-
0.0, 9.0 / 72.0, self.figure.dpi_scale_trans)
1051+
0.0, title_offset_points / 72.0,
1052+
self.figure.dpi_scale_trans)
10521053
self.title = mtext.Text(
10531054
x=0.5, y=1.0, text='',
10541055
fontproperties=props,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ axes.grid : False # display grid or not
179179
axes.grid.which : major
180180
axes.grid.axis : both
181181
axes.titlesize : large # fontsize of the axes title
182+
axes.titlepad : 5.0 # pad between axes and title in points
182183
axes.titleweight : normal # font weight for axes title
183184
axes.labelsize : medium # fontsize of the x any y labels
184185
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
@@ -1036,6 +1036,7 @@ def validate_hist_bins(s):
10361036
'axes.titlesize': ['large', validate_fontsize], # fontsize of the
10371037
# axes title
10381038
'axes.titleweight': ['normal', six.text_type], # font weight of axes title
1039+
'axes.titlepad': [9.0, validate_float], # pad from axes top to title in points
10391040
'axes.grid': [False, validate_bool], # display grid or not
10401041
'axes.grid.which': ['major', validate_axis_locator], # set wether the gid are by
10411042
# default draw on 'major'

matplotlibrc.template

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

0 commit comments

Comments
 (0)