Skip to content

Rework MaxNLocator, eliminating infinite loop; closes #6849 #6919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 22, 2016
Merged
Changes from 1 commit
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
Prev Previous commit
Add test of MaxNLocator integer option.
  • Loading branch information
efiring committed Aug 12, 2016
commit f4e4c10b6faf3f17ac29b4c32274e8cd75f0cf0c
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ def test_MaxNLocator():
assert_almost_equal(loc.tick_values(-1e15, 1e15), test_value)


@cleanup
def test_MaxNLocator_integer():
loc = mticker.MaxNLocator(nbins=5, integer=True)
test_value = np.array([-1, 0, 1, 2])
assert_almost_equal(loc.tick_values(-0.1, 1.1), test_value)

test_value = np.array([-0.25, 0, 0.25, 0.5, 0.75, 1])
assert_almost_equal(loc.tick_values(-0.1, 0.95), test_value)


def test_LinearLocator():
loc = mticker.LinearLocator(numticks=3)
test_value = np.array([-0.8, -0.3, 0.2])
Expand Down