File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -176,7 +176,13 @@ def regular_scale_axis(val_range: tuple[float, float]) -> alt.Axis:
176176 :return: Axis
177177 """
178178 val_min , val_max = val_range
179- fmt = ".1f" if (val_max - val_min ) < 3 else ".0f"
179+ val_scale = val_max - val_min
180+ if val_scale < 1 :
181+ fmt = ".2f"
182+ elif val_scale < 3 :
183+ fmt = ".1f"
184+ else :
185+ fmt = ".0f"
180186 return alt .Axis (format = fmt )
181187
182188
@@ -302,10 +308,17 @@ def transformed_spline_interpolator(
302308 :param x_data: X data
303309 :return: Y interpolator
304310 """
311+
312+ def nan_ (x : Any ) -> np .ndarray :
313+ return np .full_like (x , fill_value = np .nan , dtype = np .float64 )
314+
305315 valid = np .isfinite (y_data )
306316 x_data = np .compress (valid , x_data )
307317 y_data = np .compress (valid , y_data )
308- interp_trans_ = CubicSpline (x_trans (x_data ), y_trans (y_data ))
318+ try :
319+ interp_trans_ = CubicSpline (x_trans (x_data ), y_trans (y_data ))
320+ except ValueError :
321+ return nan_
309322
310323 def interp_ (x : Any ) -> np .ndarray :
311324 return np .asarray (y_trans_inv (interp_trans_ (x_trans (x ))))
You can’t perform that action at this time.
0 commit comments