[AstroPy] aplpy.FITSFigure combined with mpl subplots ?

Grigoris Maravelias gr.maravelias at gmail.com
Wed Jun 18 09:52:43 EDT 2014


Hello all!

How can we combine the aplpy.FITSFigure within the matplotlib subplots?

I am using this:
 f, ax = plt.subplots(rows,columns) #, sharex='col', sharey='row')
 index_list = [ind for ind in np.ndindex(rows,columns)]
 ii = 0

 for obj in list_of_images:
    plot_index = index_list[ii]
    ax[plot_index].plot(x,y)
    ii += 1

which works perfectly (iterating over all indeces, as we do not know
their number beforehand and may change from one object to another).
and we want now to add the the aplpy.FITSFigure of a fits file.

What is the best way to pass this ?

On the other hand I could take advantage of the subplot of
aplpy.FITSFigure(obj,figure=fir,subplot=[...]) but I would like to
automatically assign the positions of the subplots.
Is there an easy way to use the indexing that I show previously (i.e.
ax[plot_index])?

Best
Grigoris



More information about the AstroPy mailing list