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

Skip to content

Commit 279887f

Browse files
committed
Update text to use verticalalignment='baseline' by default. Update small number of unit tests to adapt to the new behavior.
svn path=/trunk/matplotlib/; revision=8330
1 parent 7e434f3 commit 279887f

17 files changed

Lines changed: 950 additions & 873 deletions

lib/matplotlib/axes.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ def cla(self):
865865
self.title = mtext.Text(
866866
x=0.5, y=1.0, text='',
867867
fontproperties=props,
868-
verticalalignment='bottom',
868+
verticalalignment='baseline',
869869
horizontalalignment='center',
870870
)
871871
self.title.set_transform(self.transAxes + self.titleOffsetTrans)
@@ -2866,7 +2866,7 @@ def set_title(self, label, fontdict=None, **kwargs):
28662866
"""
28672867
default = {
28682868
'fontsize':rcParams['axes.titlesize'],
2869-
'verticalalignment' : 'bottom',
2869+
'verticalalignment' : 'baseline',
28702870
'horizontalalignment' : 'center'
28712871
}
28722872

@@ -2985,9 +2985,8 @@ def text(self, x, y, s, fontdict=None,
29852985
%(Text)s
29862986
"""
29872987
default = {
2988-
'verticalalignment' : 'bottom',
2988+
'verticalalignment' : 'baseline',
29892989
'horizontalalignment' : 'left',
2990-
#'verticalalignment' : 'top',
29912990
'transform' : self.transData,
29922991
}
29932992

lib/matplotlib/axis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ def set_label_position(self, position):
13331333
"""
13341334
assert position == 'top' or position == 'bottom'
13351335
if position == 'top':
1336-
self.label.set_verticalalignment('bottom')
1336+
self.label.set_verticalalignment('baseline')
13371337
else:
13381338
self.label.set_verticalalignment('top')
13391339
self.label_position=position
@@ -1571,7 +1571,7 @@ def _get_offset_text(self):
15711571
offsetText = mtext.Text(x=0, y=0.5,
15721572
fontproperties = font_manager.FontProperties(size=rcParams['ytick.labelsize']),
15731573
color = rcParams['ytick.color'],
1574-
verticalalignment = 'bottom',
1574+
verticalalignment = 'baseline',
15751575
horizontalalignment = 'left',
15761576
)
15771577
offsetText.set_transform(mtransforms.blended_transform_factory(

lib/matplotlib/pyplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ def title(s, *args, **kwargs):
903903
Default font override is::
904904
905905
override = {'fontsize': 'medium',
906-
'verticalalignment': 'bottom',
906+
'verticalalignment': 'baseline',
907907
'horizontalalignment': 'center'}
908908
909909
.. seealso::
4.6 KB
Binary file not shown.
-1 Bytes
Loading

lib/matplotlib/tests/baseline_images/test_axes/polar_axes.svg

Lines changed: 330 additions & 180 deletions
Loading
4 Bytes
Binary file not shown.
59 Bytes
Loading

lib/matplotlib/tests/baseline_images/test_mathtext/mathtext.svg

Lines changed: 82 additions & 82 deletions
Loading
Binary file not shown.

0 commit comments

Comments
 (0)