@@ -291,15 +291,17 @@ def add_rectangle_selector(
291
291
292
292
ymin = np .floor (y_axis_vals .min ()).astype (int )
293
293
ymax = np .ceil (y_axis_vals .max ()).astype (int )
294
+ y25p = 0.25 * (ymax - ymin )
294
295
xmin = np .floor (x_axis_vals .min ()).astype (int )
295
296
xmax = np .ceil (x_axis_vals .max ()).astype (int )
297
+ x25p = 0.25 * (xmax - xmin )
296
298
297
299
# default selection is 25% of the image
298
300
if selection is None :
299
- selection = (xmin , xmin + 0.25 * ( xmax - xmin ) , ymin , ymax )
301
+ selection = (xmin , xmin + x25p , ymin , ymax )
300
302
301
- # min/max limits
302
- limits = (xmin , xmax , ymin , ymax )
303
+ # min/max limits include the data + 25% padding in the y-direction
304
+ limits = (xmin , xmax , ymin - y25p , ymax + y25p )
303
305
304
306
selector = RectangleSelector (
305
307
selection = selection ,
@@ -332,7 +334,7 @@ def _get_linear_selector_init_args(
332
334
magn_vals = data [:, 0 ]
333
335
334
336
axis_vals_min = np .floor (axis_vals .min ()).astype (int )
335
- axis_vals_max = np .floor (axis_vals .max ()).astype (int )
337
+ axis_vals_max = np .ceil (axis_vals .max ()).astype (int )
336
338
axis_vals_25p = axis_vals_min + 0.25 * (axis_vals_max - axis_vals_min )
337
339
338
340
# default selection is 25% of the image
0 commit comments