Add "+" sign for positive values in Declination

I wish to add the plus sign (“+”) for the positive values in the Declination axis (Y). I tried a lot of solutions. The method set_major_formatter seems very limited, it only allows a small usecase. It’s crazy because it’s a very simple action in terms of programming, however I’m not able to achieve this through the built-in functions that Astropy has. That’s why I’m asking for your help.

Values lower than 0 already have the “-” sign. I’m preparing sky charts for all public usage, so adding the “+” sign would be helpful for the people.

This is my line of code:

ax.coords[1].set_major_formatter('d')

I tried matplotlib.ticker. I tried to understand the CoordinatesHelper class. What can I do then?

Thanks in advance!

There isn’t already a way to do what you want, so I have created a PR for this functionality: WCSAxes: Enable specifying that tick labels always include the sign by ayshih · Pull Request #16985 · astropy/astropy · GitHub

2 Likes

Thanks a lot for making a PR. It’s a very good improvement for Astropy!

The PR has been merged, so the functionality should be available in the next major release of astropy.

1 Like