Search code examples
pythonmatplotlibfitsaplpy

How to embed a zoomed portion of a FITS image in the same plot with APLpy


I want to embed a zoomed portion of a FITS image in the same plot with APLpy.

But when loading a FITS file with APLpy, there is only a 'FITSFigure' object returned.

fig = aplpy.FITSFigure('tmp.fits', slices=[0,0])

Is it possible to make it work with zoomed_inset_axes like here , or there are some other solution?


Solution

  • You may specify the figure to which to plot with aplpy. You can then get the axes inside the figure.

    fig = plt.figure()
    aplpyfig = aplpy.FITSFigure('tmp.fits', figure=fig)
    axes = fig.get_axes()
    

    From that point onwards you can work with that axes and use any of the methods that matplotlib offers to obtain insets.

    Also see this question: Aplpy multiplot dynamic axis sharing