Unusual (?) spacing with sub-/superscripts

Hello everyone,

I frequently use subscripts and superscripts in text on my plots, but I've noticed that the line and character spacing (kerning ?) is not always as I would expect. For most things, this is not a problem. However, I would occasionally like various text objects to line up with one another, and at these times, this spacing difference can become a issue.

I guess I have a couple questions at this point... First, is this expected? Second, is there any (simple) way I can control the line and character spacing? I see there is a 'linespacing' keyword argument; however, this seems to be a multiplier relative to the total text height for each line not an absolute, fixed height of every line. For character spacing, is there a special symbol I could insert to add or removing spacing between characters?

I'm using Matploblib 1.0.0 that ships with Python(x,y) for Windows. Below is a test script that highlights these differences (at least on my system).

Any help or suggestions are most appreciated. (I don't know much TeX, so I appologize if these differences are obvious for those in the know.)


import matplotlib.pyplot as plt
plt.rc('font', size=25.0)
plt.text(0.25, 0.25,
plt.text(0.75, 0.25,
plt.text(0.5, 0.25, 'X$_{1}$Y$_{2}$\nX$^{1}$Y$^{2}$\n$X_1Y_2$\n$X^1Y^2$')