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

Skip to content

Commit ed7db9b

Browse files
committed
use bottom-alignment instead of baseline when rotation is not 0
1 parent 0f9f85f commit ed7db9b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/text.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,12 @@ def get_text_width_height_descent(*kl, **kwargs):
384384

385385
if valign=='center': offsety = (ymin + height/2.0)
386386
elif valign=='top': offsety = (ymin + height)
387-
elif valign=='baseline': offsety = (ymin + height) - baseline
387+
elif valign=='baseline':
388+
if self.get_rotation() == 0:
389+
offsety = (ymin + height) - baseline
390+
else:
391+
# if rotation is not 0, use va=bottom for baseline
392+
offsety = ymin
388393
else: offsety = ymin
389394
else:
390395
xmin1, ymin1 = cornersHoriz[0]

0 commit comments

Comments
 (0)