|
12 | 12 |
|
13 | 13 | import matplotlib.transforms as mtrans
|
14 | 14 | import matplotlib.pyplot as plt
|
| 15 | +import matplotlib.path as mpath |
| 16 | +import matplotlib.patches as mpatches |
| 17 | + |
15 | 18 |
|
16 | 19 |
|
17 | 20 | @cleanup
|
@@ -325,8 +328,29 @@ def test_line_extents_non_affine(self):
|
325 | 328 | expeted_data_lim = np.array([[0., 0.], [9., 9.]]) + 20
|
326 | 329 | np.testing.assert_array_almost_equal(ax.dataLim.get_points(),
|
327 | 330 | expeted_data_lim)
|
328 |
| - |
329 |
| - |
| 331 | + |
| 332 | + def test_pathc_extents_non_affine(self): |
| 333 | + ax = plt.axes() |
| 334 | + offset = mtrans.Affine2D().translate(10, 10) |
| 335 | + na_offset = NonAffineForTest(mtrans.Affine2D().translate(10, 10)) |
| 336 | + pth = mpath.Path(np.array([[0, 0], [0, 10], [10, 10], [10, 0]])) |
| 337 | + patch = mpatches.PathPatch(pth, transform=offset + na_offset + ax.transData) |
| 338 | + ax.add_patch(patch) |
| 339 | + expeted_data_lim = np.array([[0., 0.], [10., 10.]]) + 20 |
| 340 | + np.testing.assert_array_almost_equal(ax.dataLim.get_points(), |
| 341 | + expeted_data_lim) |
| 342 | + |
| 343 | + def test_pathc_extents_affine(self): |
| 344 | + ax = plt.axes() |
| 345 | + offset = mtrans.Affine2D().translate(10, 10) |
| 346 | + pth = mpath.Path(np.array([[0, 0], [0, 10], [10, 10], [10, 0]])) |
| 347 | + patch = mpatches.PathPatch(pth, transform=offset + ax.transData) |
| 348 | + ax.add_patch(patch) |
| 349 | + expeted_data_lim = np.array([[0., 0.], [10., 10.]]) + 10 |
| 350 | + np.testing.assert_array_almost_equal(ax.dataLim.get_points(), |
| 351 | + expeted_data_lim) |
| 352 | + |
| 353 | + |
330 | 354 | if __name__=='__main__':
|
331 | 355 | import nose
|
332 | 356 | nose.runmodule(argv=['-s','--with-doctest'], exit=False)
|
0 commit comments