The data are coordinates of objects in the sky, for example as follows:
import pylab as plt
import numpy as np
l = np.random.uniform(-180, 180, 2000)
b = np.random.uniform(-90, 90, 2000)
I want to do a 2D histogram in order to plot a map of the density of some point with (l, b)
coordinates in the sky, using HEALPix pixellization on Mollweide projection. How can I do this using healpy ?
The tutorial:
says how to plot a 1D array, or a fits file, but I don't find how to do a 2d histogram using this pixellization.
I also found this function, but it is not working , so I am stuck.
hp.projaxes.MollweideAxes.hist2d(l, b, bins=10)
I can do a plot of these points in Mollweide projection this way :
l_axis_name ='Latitude l (deg)'
b_axis_name = 'Longitude b (deg)'
fig = plt.figure(figsize=(12,9))
ax = fig.add_subplot(111, projection="mollweide")
ax.grid(True)
ax.scatter(np.array(l)*np.pi/180., np.array(b)*np.pi/180.)
plt.show()
Thank you very much in advance for your help.