Skip to content

Vertical alignment of text is too high #2527

Closed
@breedlun

Description

@breedlun

One of the improvements to matplotlib 1.3.0 is supposed to be improved vertical alignment of text, but it appears to have gotten worse in my experience. Here is an example:

import matplotlib.pylab as plt
mpl.rcParams['font.size'] = 24
fig = plt.figure(figsize = (5,5))
ax = plt.subplot(111)
ax.plot([0,1], [0,1])

txts = ['1', '2', '3']
y_coords = [0.8, 0.5, 0.2]
for txt, y_coord in zip(txts, y_coords):
    ax.annotate(txt, xy = (0.25, y_coord), fontname = 'Helvetica', \
        size=36, va='center', ha='center', \
        bbox=dict(boxstyle='square', fc = 'w'))

plt.savefig('Test.png', bbox_inches = 'tight', pad_inches = 0)

In matplotlib 1.2.1 the png looks like this

test_mpl_1 2 1

but in matplotlib 1.3.0 the png looks like this

test_mpl_1 3

The numbers in the the v1.3.0 png are too high. The numbers should be in the center of the rectangular boxes, and the center of the tick mark numbers should line up with the tick marks.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions