Open tamasgal opened 4 months ago
Hi @tamasgal , unfortunately Healpix.jl is not as sophisticated as Healpy when producing plots. Basically, when you plot a map there is a small raytracer (see the project function) that trace rays and find where they hit the unitary sphere according to the inverse projection function (which converts a 2D point x,y into a 3D direction θ,φ).
Thus, the output plot produced by Plots.jl has no knowledge of the coordinate transformation that was done internally by Healpix.jl. Thus, your annotate!
call interprets the (x,y) point in the 2D space of the window and not in the 3D space of the surface of the sphere 🙁.
Implementing proper coordinate conversions would be a very welcomed PR. However, I do not know the amount of support for coordinate transformations provided by Plots.jl. Perhaps it would be better to provide a plotting backend for Healpix.jl based on Makie.jl: judging from some demos I've seen, it might be that it is perfectly capable of doing this.
Yes that's what I also understood.
Well I used Plots.jl
because there was a recipe but I would definitely prefer Makie.jl
;)
It's actually not that complicated to display a similar plot in Makie.jl
:
img, mask, anymasked = mollweide(m, Dict()) # m is a HealpixMap like above
fig = Figure(size = (1800, 900))
ax = CairoMakie.Axis(fig[1, 1], aspect = 2)
hidedecorations!(ax)
heatmap!(ax, img', show_axis = false)
hidespines!(ax)
fig
gives
So now back to the original problem of transforming the coordinates but in Makie.jl
;) I'll come back if I have some news.
I am having trouble to find out how to get the pixel coordinates for a given angle.
Here, obviously
annotate!
is not printed in the coordinate system of the plot. I foundang2pix
but that only gives the pixel number. How can I find the "plot coordinate" for a given angle or vector?