Monday, January 18, 2010

Easy ways of adding math/greek in your IDL plots

It's not straightforward to add greek letters, math etc in IDL plots. Fortunately, there are some libraries that make our life easier for this purpose:

TeXtoIDL

The purpose of the TeXtoIDL routines is to make it simple to use Greek letters, subscripts and superscripts in making labels for plots in IDL. This is accomplished by allowing the user to use TeX control sequences for Greek letters and special symbols and for sub/superscripts.

Example:
The command below uses textoidl to create a somewhat fancy X label.
IDL > plot, [0], [0], xtitle=textoidl("\rho^2 + 2\Gamma_{ij}")

Greek (Coyote Library)

Another way of inserting greek letters in your plots. The command greek('mu') for example returns a string with the greek letter mu.

Example:
IDL > Plot, [0], [0], XTitle='Wavelength (' + Greek('mu') + 'm)'

No comments:

Post a Comment

 
Locations of visitors to this page