Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Plot limit with transform #731

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 11 commits into from
Aug 21, 2012
Merged
Prev Previous commit
Next Next commit
All tests work as expected.
  • Loading branch information
Phil Elson authored and pelson committed Aug 20, 2012
commit 22865652c16bc52aae81ab1ab8501b101113969e
28 changes: 26 additions & 2 deletions 28 lib/matplotlib/tests/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

import matplotlib.transforms as mtrans
import matplotlib.pyplot as plt
import matplotlib.path as mpath
import matplotlib.patches as mpatches



@cleanup
Expand Down Expand Up @@ -325,8 +328,29 @@ def test_line_extents_non_affine(self):
expeted_data_lim = np.array([[0., 0.], [9., 9.]]) + 20
np.testing.assert_array_almost_equal(ax.dataLim.get_points(),
expeted_data_lim)



def test_pathc_extents_non_affine(self):
ax = plt.axes()
offset = mtrans.Affine2D().translate(10, 10)
na_offset = NonAffineForTest(mtrans.Affine2D().translate(10, 10))
pth = mpath.Path(np.array([[0, 0], [0, 10], [10, 10], [10, 0]]))
patch = mpatches.PathPatch(pth, transform=offset + na_offset + ax.transData)
ax.add_patch(patch)
expeted_data_lim = np.array([[0., 0.], [10., 10.]]) + 20
np.testing.assert_array_almost_equal(ax.dataLim.get_points(),
expeted_data_lim)

def test_pathc_extents_affine(self):
ax = plt.axes()
offset = mtrans.Affine2D().translate(10, 10)
pth = mpath.Path(np.array([[0, 0], [0, 10], [10, 10], [10, 0]]))
patch = mpatches.PathPatch(pth, transform=offset + ax.transData)
ax.add_patch(patch)
expeted_data_lim = np.array([[0., 0.], [10., 10.]]) + 10
np.testing.assert_array_almost_equal(ax.dataLim.get_points(),
expeted_data_lim)


if __name__=='__main__':
import nose
nose.runmodule(argv=['-s','--with-doctest'], exit=False)
2 changes: 1 addition & 1 deletion 2 lib/matplotlib/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import cbook
from path import Path

DEBUG = True
DEBUG = False
if DEBUG:
import warnings

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.