Hi All,

Trying to tune alignment of xtick labels.

I have the following for my lables

===
import matlplotlib.pyplot as plt

x_dat = [1,2,3,4]
x_label = ['$\mathrm{nn}$' , '${}^2\mathrm{H}$', '${}^4\mathrm{He}$', 
'${}^4_{\Lambda\Lambda}\mathrm{He}$']

plt.xticks(x_dat,x_label)
===

you can see I have both superscripts and subscripts (and sometimes none) on 
these labels.
Try as I might, I can not figure out how to get these to align how I want (I 
have tried all the options from verticalalignment=option in the plt.xticks() 
command.

If LaTeX were rendering such fonts (in a TeX document), it would align the 
bottom of the characters, and then place the super and sub scripts accordingly.

It seems that matplotlib is creating a bounding box around each label, and then 
aligning according to the top, bottom or center of the corresponding bounding 
boxes.

Is there a way to get the alignment to work according to my above description 
(the LaTeX way)?
If it involves fine tuning the position of each label - could someone 
demonstrate a simple example of how to set the positions individually?


I am using the mathtext (there are issues I have had trying to get latex to 
work with my current set up, which I am still working on, but aren't sorted out 
yet).


Thanks,

Andre
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to