[AstroPy] equivalent routine to IDL Astronomy Library lineid_plot

Taro Sato taro at ap.smu.ca
Wed Aug 24 10:48:39 EDT 2011

On Wed, Aug 24, 2011 at 11:34 AM, Jonathan Slavin
<jslavin at cfa.harvard.edu> wrote:
> Johann,
> I wouldn't expect matplotlib to include such a routine either, but I
> thought that maybe some astronomer might have had enough motivation to
> adapt the routine.  I'm attaching a figure that I made with the IDL
> routine.
> The tricky parts as far as I can tell are making sure there is enough
> space above the figure (providing that one wants the line labels to be
> above the figure as the IDL routine makes them) and the creation of
> those multi-segment lines when the labels are too close together.  There
> are facilities within matplotlib with the annotate command to make such
> lines, though how to apply it to this specific use is not clear to me.
> Jon

I have my own custom routine to display line identifications at given
redshift but it's not smart enough to avoid overlapping; it only
alternates the offsets so that adjacent labels won't always overlap.
What you have in your example plot is certainly doable with MPL...
It's tricky to ensure that labels are readable most of the time but
since you know how to approach the problem, why don't you create one
and make it available publicly!  If the desired algorithm needed is
already coded in the IDL script it shouldn't be too painful.  :D

Taro Sato
Department of Astronomy & Physics
Saint Mary's University             email: taro at ap.smu.ca
Halifax, NS B3H 3C3                 phone: (902)420-5027
Canada                                web: http://ap.smu.ca/~taro

More information about the AstroPy mailing list