@@ -2599,38 +2599,32 @@ def get_log_range(lo, hi):
25992599 return lo , hi
26002600
26012601 # Calculate all the ranges, so we can determine striding
2602+ a_lo , a_hi = (0 , 0 )
26022603 if has_a :
2603- if has_b :
2604- a_range = get_log_range (linthresh , np .abs (vmin ) + 1 )
2605- else :
2606- a_range = get_log_range (np .abs (vmax ), np .abs (vmin ) + 1 )
2607- else :
2608- a_range = (0 , 0 )
2604+ a_upper_lim = min (- linthresh , vmax )
2605+ a_lo , a_hi = get_log_range (np .abs (a_upper_lim ), np .abs (vmin ) + 1 )
26092606
2607+ c_lo , c_hi = (0 , 0 )
26102608 if has_c :
2611- if has_b :
2612- c_range = get_log_range (linthresh , vmax + 1 )
2613- else :
2614- c_range = get_log_range (vmin , vmax + 1 )
2615- else :
2616- c_range = (0 , 0 )
2609+ c_lower_lim = max (linthresh , vmin )
2610+ c_lo , c_hi = get_log_range (c_lower_lim , vmax + 1 )
26172611
26182612 # Calculate the total number of integer exponents in a and c ranges
2619- total_ticks = (a_range [ 1 ] - a_range [ 0 ] ) + (c_range [ 1 ] - c_range [ 0 ] )
2613+ total_ticks = (a_hi - a_lo ) + (c_hi - c_lo )
26202614 if has_b :
26212615 total_ticks += 1
26222616 stride = max (total_ticks // (self .numticks - 1 ), 1 )
26232617
26242618 decades = []
26252619 if has_a :
2626- decades .extend (- 1 * (base ** (np .arange (a_range [ 0 ], a_range [ 1 ] ,
2620+ decades .extend (- 1 * (base ** (np .arange (a_lo , a_hi ,
26272621 stride )[::- 1 ])))
26282622
26292623 if has_b :
26302624 decades .append (0.0 )
26312625
26322626 if has_c :
2633- decades .extend (base ** (np .arange (c_range [ 0 ], c_range [ 1 ] , stride )))
2627+ decades .extend (base ** (np .arange (c_lo , c_hi , stride )))
26342628
26352629 # Add the subticks if requested
26362630 if self ._subs is None :
0 commit comments