[AstroPy] how to mark spectral lines in matplotlib?

Thøger Emil Rivera-Thorsen trive at astro.su.se
Sat Dec 14 18:33:33 EST 2013


On 14-12-2013 17:14, gonghang.naoc wrote:

> Hi astropyers,
> I have a ready made spectral line atlas. Is there a direct way to mark 
> the spectral lines in one spectrum plot?
> I have found  a module called lineid_plot. However,I can not install it.
>
> The images below are three examples.
> http://www.cv.nrao.edu/course/astr534/images/bandscan.gif
> http://skyserver.sdss3.org/dr8/en/tools/quicklook/quickobj.asp?id=1237662661600608302
> http://inspirehep.net/record/878108/files/plot_mean_spec1.png
>
> Thank you.
>
> hang

I usually do this by reading my lines into a dict of the form |{'Line 
Name': wavelength}| and then using a code snippet like this:

|for  thelinein  MWlines.keys():
     ax.axvline(
         x=MWlines[theline], ymin=.5, ymax=.99,
         lw=1.5, color='grey', ls=':')
     ax.annotate(
         theline+' MW', (MWlines[theline]-.0,2.2),
         backgroundcolor='white', rotation='vertical',
         horizontalalignment='center', color='grey')|

This will of course be varied slightly depending on the context, but 
that's the basic idea.

>
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20131215/41f53926/attachment.html>


More information about the AstroPy mailing list