I'm using hp.mollview() to draw a map where the entire projection is not fully populated. This makes it unclear where the boundaries of the map are because the white background just blends into the white of the figure area. Is it possible to draw a border around the map area?
Asked
Active
Viewed 835 times
2 Answers
1
I had the same problem and unfortunately do not have a direct solution, but I did find a workaround. You can change the background colour of your figure and of the masked pixels separately. See below an example using the inferno colour map, with white background but grey masked pixels.
import healpy as hp
from pylab import cm
# Some map with masked pixels
npix = hp.nside2npix(4)
m = np.arange(npix, dtype=float)
m[50:100] = hp.UNSEEN
# adjusting the colour map
cmap = cm.inferno
cmap.set_under('w')
cmap.set_bad('grey')
hp.mollview(m, cmap=cmap)
healpy map with different coloured background and masked pixels

Janna112358
- 46
- 2
0
You can use an empty graticule to add a border:
import healpy as hp
from pylab import cm
npix = hp.nside2npix(4)
m = np.arange(npix, dtype=float)
m[50:100] = hp.UNSEEN
cmap = cm.Blues
cmap.set_under('w')
hp.mollview(m,cmap=cmap)
hp.graticule(dmer=360,dpar=360,alpha=0)

wordy
- 539
- 5
- 15