7

I have a HealPix plot, made with HEALPY, as in Healpy: From Data to Healpix map (with less pixels, for instance taking nside=2, see code below).

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)

example plot

How can I write a text with a value in the center of each HEALPix I have on the plot ? For example, how to write an identifuer for each 'pixel', using an array like range(len(hpxmap)) ?

Thanks a lot in advance for your help !

AlbertBranson
  • 405
  • 2
  • 7
  • Could you provide an example and provide a few more details? The values in the center of each pixel is just the value in the array. – Daniel Lenz Jun 08 '18 at 09:39
  • Thanks for your comment, I provided an example and more details – AlbertBranson Jun 08 '18 at 12:13
  • Thanks for clarifying! I'd suggest to check out [`healpy.annotate()`](http://healpy.readthedocs.io/en/1.9.1/generated/healpy.projaxes.CartesianAxes.annotate.html), but I haven't used it myself yet. – Daniel Lenz Jun 08 '18 at 12:44

0 Answers0