@@ -902,16 +902,21 @@ def _round_ticks(values: np.ndarray, sig: int = 2) -> np.ndarray:
902902def _arcsec_labels (ticks ) -> List [str ]:
903903 """Format tick values as arcsecond coordinate strings.
904904
905- Values that all end in ``.0`` are stripped of the decimal point before the
906- ``"`` suffix is appended, so ``[-1.0, 0.0, 1.0]`` becomes
907- ``['-1"', '0"', '1"']``. By default decimal labels keep the suffix form
908- ``3.8"``. When ``ticks.symbol_over_decimal`` is true, labels use the
909- double-prime arcsecond symbol and decimal labels place it over the decimal
910- point, e.g. ``3.″8``.
905+ Whole-number tick sets render without a decimal point, so
906+ ``[-1.0, 0.0, 1.0]`` becomes ``['-1"', '0"', '1"']``. When whole-number and
907+ decimal ticks are mixed, the whole-number ticks gain a single decimal place
908+ (e.g. ``2`` -> ``2.0``) so a lone integer tick reads consistently with its
909+ neighbours (``2.″0`` rather than ``2″`` beside ``-0.″044``). By default
910+ decimal labels keep the suffix form ``3.8"``. When
911+ ``ticks.symbol_over_decimal`` is true, labels use the double-prime arcsecond
912+ symbol and decimal labels place it over the decimal point, e.g. ``3.″8``.
911913 """
912914 labels = [f'{ v :g} ' for v in ticks ]
913- if all (label .endswith (".0" ) for label in labels ):
914- labels = [label [:- 2 ] for label in labels ]
915+ if any ("." in label for label in labels ):
916+ labels = [
917+ label if "." in label else f"{ float (v ):.1f} "
918+ for label , v in zip (labels , ticks )
919+ ]
915920 if _conf_ticks_flag ("symbol_over_decimal" , False ):
916921 symbol_labels = []
917922 for label in labels :
@@ -948,3 +953,9 @@ def apply_extent(
948953 ax .set_yticks (yticks )
949954 ax .set_xticklabels (_arcsec_labels (xticks ))
950955 ax .set_yticklabels (_arcsec_labels (yticks ))
956+
957+ # The y-tick labels are rotated 90 degrees elsewhere; without an explicit
958+ # centre alignment a rotated label anchors at its right edge and visually
959+ # drops below the tick line. Centre them on the tick.
960+ for label in ax .get_yticklabels ():
961+ label .set_verticalalignment ("center" )
0 commit comments