healpy plot two figure

2018-09-26  本文已影响0人  uurr

If you want to have healpy plots in matplotlib subplots, the following would be the way to go. The key is to use plt.axes() to select the active subplot and to use the hold=True keyword in the healpy functions.

import healpy as hp

import numpy as np

import matplotlib.pyplot as plt

fig, (ax1, ax2) = plt.subplots(ncols=2)

plt.axes(ax1)

hp.mollview(np.random.random(hp.nside2npix(32)), hold=True)

plt.axes(ax2)

hp.mollview(np.arange(hp.nside2npix(32)), hold=True)

上一篇 下一篇

猜你喜欢

热点阅读