Is there any way to make multiplot aplpy plots dynamically share axes so that when one is moved or zoomed, it moves and zooms the others?
I can achieve the affect using matplotlib pyplot's imshow and subplot routines, but using those limits some other important aspects of my plotting, while aplpy provides all the tools I need for my images.
I have tried using the matplotlib cid commands and a function to recenter all the images based on click locations, but I can only zoom in, or out, not both, and I cant click and drag yet.
My MWE of my plotting code is below:
from astropy.io import fits
import matplotlib.pyplot as plt
import aplpy
root = '/my/data/directory/'
data = '3d_image.fits'
hdu = fits.open(root + data)[0]
hdr = hdu.header
fits1 = fits.PrimaryHDU(data = hdu.data[4,:,:], header = hdr)
fits2 = fits.PrimaryHDU(data = hdu.data[6,:,:], header = hdr)
fig = plt.figure(figsize=(15, 15))
f1 = aplpy.FITSFigure(fits1, figure=fig, subplot=[0.1,0.1,0.8,0.35])
f1.show_colorscale(cmap = 'coolwarm', vmin = 8., vmax = 10.5)
f2 = aplpy.FITSFigure(fits2, figure=fig, subplot=[0.1,0.5,0.8,0.35])
f2.show_colorscale(cmap = 'coolwarm', vmin = 1.2, vmax = 1.6)
fig.show
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…