Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions lib/matplotlib/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2706,6 +2706,29 @@ def get_log_range(lo, hi):
else:
ticklocs = decades

# Add ticks with linear spacing in the linear region for better
# density near zero.
if has_b:
if self.numticks is None:
n_linear = 3
elif self.numticks <= 0:
n_linear = 0
else:
n_linear = min(5, self.numticks)

if n_linear > 0:
linear_vmin = max(vmin, -linthresh)
linear_vmax = min(vmax, linthresh)

if linear_vmax > linear_vmin:
linear_ticks = np.linspace(
linear_vmin, linear_vmax, n_linear
)
all_ticks = np.concatenate(
[np.asarray(ticklocs), linear_ticks]
)
ticklocs = np.sort(np.unique(all_ticks))

return self.raise_if_exceeds(np.array(ticklocs))

def view_limits(self, vmin, vmax):
Expand Down
Loading