Alb*_*son 6 python plot matplotlib healpy
我有一个用HEALPY制作的HealPix图,如Healpy:从数据到Healpix图(像素较少,例如,nside = 2,请参见下面的代码)。
import healpy as hp
import numpy as np
import matplotlib.pyplot as plt
# Set the number of sources and the coordinates for the input
nsources = int(1.e4)
nside = 2
npix = hp.nside2npix(nside)
# Coordinates and the density field f
thetas = np.random.random(nsources) * np.pi
phis = np.random.random(nsources) * np.pi * 2.
fs = np.random.randn(nsources)
# Go from HEALPix coordinates to indices
indices = hp.ang2pix(nside, thetas, phis)
# Initate the map and fill it with the values
hpxmap = np.zeros(npix, dtype=np.float)
hpxmap[indices] += fs[indices]
# Inspect the map
hp.mollview(hpxmap)
Run Code Online (Sandbox Code Playgroud)
如何在绘图中每个HEALPix的中间写一个值带有值的文本?例如,如何使用像这样的数组为每个“像素”写一个标识符 range(len(hpxmap))?
在此先感谢您的帮助!