Python Forum
Add tick labels in healpy.mollview ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add tick labels in healpy.mollview ?
#1
Hi !

I have a FITS/Healpix map that I plot using Mollview, like in this link

I have no problems adding the grid (graticule), but how can I add the tick labels ??
How is it possible to add (and then modify) the tick labels with healpy.mollview(...) ?

Thanks a lot for your help !

B.
Reply
#2
I didn't work with healpy, but its graphical facilities are likely built up on top of matplotlib.
Are you trying to add tick labels to the colorbar at bottom of the mollview? If so, you can try the following approach: set keyword argument cbar=False, e.g. mollview(...., ...., cbar=False),
and than try to crate colorbar manually, e.g.

# prevent jupyter to show plots without invoking `plt.show()`  # you probably need to remove matplotlib inline? 
hp.mollview(wmap_map_I_masked.filled(), cbar=False)
fig = plt.gcf()
ax = plt.gca()
fig.colorbar()
cbar = fig.colorbar(cax, ticks=[-1, 0, 1], orientation='horizontal')  # set some values to ticks
cbar.ax.set_xticklabels(['negative', 'zero', 'positive']) 
...
# finally:
plt.show()
Reply
#3
Thanks a lot for your reply !

Actually, this is not what I try to do.

I want to add tick labels directly on the axis of the mollview plot that I plotted directly with hp.mollview like in the example you give, to obtain a mollweide grid like in this link.

When plotting directly the map with hp.mollview, I can figure a way to add the tick label. Adding the grid works (hp.graticule()), but there are no tick labels...

Thanks...

B.
Reply
#4
Unfortunately, it seems that the only way to create labels is to use matplotlib...
Reply
#5
Thanks a lot for the link, I will try that.

But this is unfortunate that maps plotted with healpy cannot be modified ?
No way to handle/modify the maps plotted with hp.mollview ?

Thanks,

B.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to prevent tick labels overlapping with axis SriRajesh 2 23,905 May-12-2018, 06:13 PM
Last Post: SriRajesh

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020