[AstroPy] APLpy color bar for markers

Thøger Emil Rivera-Thorsen trive at astro.su.se
Mon Mar 7 12:38:27 EST 2016


I would do this by tapping directly into the Matplotlib/pylab api to do 
this:

|import matplotlib.pyplot as plt import aplpy as ap fig = 
ap.FITSFigure('myimage.fits') fig.show_grayscale() f, a = plt.gcf(), 
plt.gca() x, y = fig.world2pixel(ra, dec) points = a.scatter(ra, dec, 
c=velocity, cmap='rainbow') fig.colorbar(points) |

The colorbar is not as neatly aligned as the APLPy function does, but 
this can be refined and tweaked, if you read the matplotlib docs (or you 
can just use it as-is).

On 03/07/2016 04:52 PM, Ke Wang wrote:

> Hi,
>
> This should be a simple question, but I just don't find an obvious 
> solution:
>
> I use APLpy to plot a FITS image with nice wcs coordinates support, 
> and overlay color coded markers:
>
> fig = aplpy.FITSFigure('image.fits')
> fig.show_colorscale(cmap='gray')
> fig.show_markers(ra, dec, c=velocity, cmap='rainbow')
> fig.add_colorbar()
>
> This will plot a gray color bar (for the image). But I want to display 
> the rainbow (for markers). Any idea would be appreciated.
>
> Cheers,
> Ke
>
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> https://mail.scipy.org/mailman/listinfo/astropy

​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20160307/855863d6/attachment.html>


More information about the AstroPy mailing list