File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -41,18 +41,21 @@ def comparison_plot(
4141 x_values = data_frame [data_frame .columns [0 ]].to_numpy (dtype = float )
4242 y_values = data_frame [data_frame .columns [1 ]].to_numpy (dtype = float )
4343 valid_mask = ~ (np .isnan (x_values ) | np .isnan (y_values ))
44+
45+ # Filter out NaN values
4446 x_values = x_values [valid_mask ]
4547 y_values = y_values [valid_mask ]
4648
47- # Determine if data is log scale, linregress tells us how linear the data is.
4849 # Guard against degenerate data (single point or no variance) to avoid SciPy warnings.
4950 if (
5051 x_values .size >= 2
5152 and y_values .size >= 2
5253 and np .ptp (x_values ) > 0
5354 and np .ptp (y_values ) > 0
5455 ):
55- linregress = stats .linregress (x_values , y_values )
56+ linregress = stats .linregress (x_values , y_values ) # Perform linear regression
57+
58+ # Determine if log scale is appropriate based on correlation by checking r-value and p-value
5659 log_scale = not (linregress .rvalue > 0.65 and linregress .pvalue < 0.05 )
5760 else :
5861 log_scale = False
You can’t perform that action at this time.
0 commit comments