Hi to everybody,
In the past years, I have developed a library that implements Healpix projection functions: GitHub - ziotom78/Healpix.jl: Healpix library written in Julia. Unlike Michael Eastwood’s Libhealpix.jl, this library is 100% pure Julia, because I needed to make it run under Windows as well (Libhealpix is a wrapper to the C++ Healpix library, which does not support Windows yet).
So far, I have managed to produce cartographic projections using Cairo to create RGB bitmaps, which look nice in Jupyter but are not shown in the REPL. As the dependency on Cairo, Images, and ImageMagick is quite heavy and does not work well for those applications that need to run on clusters, I would like to move to RecipesBase.
Using Cairo has allowed me to render images similar to the one here:
This is a Mollweide projection of the celestial sphere, where pixels along the Galactic plane have been masked and are shown in gray.
My question is: how am I supposed to produce this kind of images using RecipesBase? My understanding is that I should write a @recipe
returning a matrix containing the 2D projection of the map, using missing
for the pixels outside the ellipse. This matrix should contain floating-point values, which would be mapped to colors by a user-specified color scale, like the ones defined in ColorSchemes.jl. But how could I specify that «masked» pixels must be painted using a dedicated color?
The Python bindings to Healpix use Matplotlib’s features to provide custom axis that take care of the projection (healpy/projaxes.py#L719); from my understanding, in this case pixels get a gray color if they map to some special values (like numpy.NaN
), and pixels outside the ellipse are never painted at all.
The best solution would allow to add layers of vector elements: the most common case is a graticule showing parallels and meridians, and points and lines indicating sky sources and regions.
(P.S. I have made the case of Mollweide projections, but the library should provide other projections as well, of corse. So I am looking for some general way to implement this, which does not assume that the pixels will be always plotted within an ellipse.)
Thanks a lot!
Maurizio.