@@ -3119,7 +3119,7 @@ def _mark_second_Y_axis_in_best_plot(self):
3119
3119
ticks = mm .Utils .get_mag_from_flux (flux )
3120
3120
ax2 .set_ylabel (label ).set_color (color )
3121
3121
ax2 .spines ['right' ].set_color (color )
3122
- ax2 .set_ylim (ylim [0 ], ylim [1 ])
3122
+ ax2 .set_ylim (ticks [0 ], ylim [1 ])
3123
3123
ax2 .tick_params (axis = 'y' , colors = color )
3124
3124
plt .yticks (ticks , labels , color = color )
3125
3125
@@ -3144,6 +3144,8 @@ def _second_Y_axis_optimal(self, ax2, A_min, A_max):
3144
3144
ax2 .set_ylim (A_min , A_max )
3145
3145
A_values = ax2 .yaxis .get_ticklocs ().round (7 )
3146
3146
A_values = A_values [(A_values >= max (1 , A_min )) & (A_values < A_max )]
3147
+ if 1. not in A_values :
3148
+ A_values = np .insert (A_values , 0 , 1. )
3147
3149
is_integer = [mag .is_integer () for mag in A_values ]
3148
3150
if all (is_integer ):
3149
3151
labels = [f"{ int (x ):d} " for x in A_values ]
@@ -3174,7 +3176,7 @@ def _second_Y_axis_warnings(self, flux, labels, A_values, A_min, A_max):
3174
3176
"be translated to magnitudes." )
3175
3177
warnings .warn (msg .format (np .sum (np .logical_not (mask ))))
3176
3178
3177
- if (np .min (A_values ) < A_min or np .max (A_values ) > A_max or
3179
+ if (np .min (A_values ) < min ( A_min , 1 ) or np .max (A_values ) > A_max or
3178
3180
np .any (flux < 0. )):
3179
3181
msg = ("Provided magnifications for the second (i.e., right-hand "
3180
3182
"side) Y-axis scale are from {:} to {:},\n but the range "
0 commit comments