Thursday, August 30, 2012

The Angstrom symbol

Update, use the latex mode of python.  The r means it's a raw string:
 plt.xlabel(r'wavelength($\AA$)')

Another example stolen from stackoverflow:
    plt.ylabel(r'Microstrain [$\mu \epsilon$]')




In the weird multiaxis environment I was in, I needed this:
upper.set_xlabel(ur"observed-frame vacuum wavelength (\u00c5)")

But if I had just been in a regular plot, this should have worked:
xlabel = ur"Wavelength (\u00c5)"


The "ur" chooses the font, I think, and the \u00c5 hieroglyphics asks for an Angstrom in unicode.
Source (answer provided by an STScI person.)

No comments:

Post a Comment