diff --git a/examples/pylab_examples/transoffset.py b/examples/pylab_examples/transoffset.py index 1ee730b6fb56..381e9c6892d9 100644 --- a/examples/pylab_examples/transoffset.py +++ b/examples/pylab_examples/transoffset.py @@ -16,7 +16,7 @@ ''' import matplotlib.pyplot as plt -import matplotlib.transforms as mtrans +import matplotlib.transforms as mtransforms import numpy as np from matplotlib.transforms import offset_copy @@ -31,8 +31,8 @@ # we only need to make one transform. To get the # transform argument to offset_copy, we need to make the axes # first; the subplot command above is one way to do this. -trans_offset = mtrans.offset_copy(ax.transData, fig=fig, - x=0.05, y=0.10, units='inches') +trans_offset = mtransforms.offset_copy(ax.transData, fig=fig, + x=0.05, y=0.10, units='inches') for x, y in zip(xs, ys): plt.plot((x,), (y,), 'ro') @@ -42,7 +42,7 @@ # offset_copy works for polar plots also. ax = plt.subplot(2, 1, 2, projection='polar') -trans_offset = mtrans.offset_copy(ax.transData, fig=fig, y=6, units='dots') +trans_offset = mtransforms.offset_copy(ax.transData, fig=fig, y=6, units='dots') for x, y in zip(xs, ys): plt.polar((x,), (y,), 'ro') diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index c7497d8997c4..1fddd357a61e 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -40,7 +40,6 @@ import matplotlib.ticker as mticker import matplotlib.transforms as mtransforms import matplotlib.tri as mtri -import matplotlib.transforms as mtrans from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer from matplotlib.axes._base import _AxesBase from matplotlib.axes._base import _process_plot_format @@ -4251,8 +4250,8 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None, ymin, ymax = (np.min(y), np.max(y)) if len(y) else (0, 1) # to avoid issues with singular data, expand the min/max pairs - xmin, xmax = mtrans.nonsingular(xmin, xmax, expander=0.1) - ymin, ymax = mtrans.nonsingular(ymin, ymax, expander=0.1) + xmin, xmax = mtransforms.nonsingular(xmin, xmax, expander=0.1) + ymin, ymax = mtransforms.nonsingular(ymin, ymax, expander=0.1) # In the x-direction, the hexagons exactly cover the region from # xmin to xmax. Need some padding to avoid roundoff errors. diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index df488bba7811..be9311926f17 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -39,7 +39,7 @@ import matplotlib.patches as mpatches import matplotlib.path as mpath import matplotlib.ticker as ticker -import matplotlib.transforms as mtrans +import matplotlib.transforms as mtransforms from matplotlib import docstring @@ -687,9 +687,10 @@ def _process_values(self, b=None): self.norm.vmin = 0 self.norm.vmax = 1 - self.norm.vmin, self.norm.vmax = mtrans.nonsingular(self.norm.vmin, - self.norm.vmax, - expander=0.1) + self.norm.vmin, self.norm.vmax = mtransforms.nonsingular( + self.norm.vmin, + self.norm.vmax, + expander=0.1) b = self.norm.inverse(self._uniform_y(self.cmap.N + 1)) @@ -1126,8 +1127,8 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15, 'parents share the same figure.') # take a bounding box around all of the given axes - parents_bbox = mtrans.Bbox.union([ax.get_position(original=True).frozen() - for ax in parents]) + parents_bbox = mtransforms.Bbox.union( + [ax.get_position(original=True).frozen() for ax in parents]) pb = parents_bbox if location in ('left', 'right'): @@ -1148,12 +1149,12 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15, # define a transform which takes us from old axes coordinates to # new axes coordinates - shrinking_trans = mtrans.BboxTransform(parents_bbox, pb1) + shrinking_trans = mtransforms.BboxTransform(parents_bbox, pb1) # transform each of the axes in parents using the new transform for ax in parents: new_posn = shrinking_trans.transform(ax.get_position()) - new_posn = mtrans.Bbox(new_posn) + new_posn = mtransforms.Bbox(new_posn) ax.set_position(new_posn) if parent_anchor is not False: ax.set_anchor(parent_anchor) diff --git a/lib/matplotlib/contour.py b/lib/matplotlib/contour.py index 3264c67ad2e8..ab9b1b1cedf3 100644 --- a/lib/matplotlib/contour.py +++ b/lib/matplotlib/contour.py @@ -26,7 +26,7 @@ import matplotlib.mathtext as mathtext import matplotlib.patches as mpatches import matplotlib.texmanager as texmanager -import matplotlib.transforms as mtrans +import matplotlib.transforms as mtransforms from matplotlib.cbook import mplDeprecation # Import needed for adding manual selection capability to clabel @@ -967,7 +967,7 @@ def get_transform(self): """ if self._transform is None: self._transform = self.ax.transData - elif (not isinstance(self._transform, mtrans.Transform) + elif (not isinstance(self._transform, mtransforms.Transform) and hasattr(self._transform, '_as_mpl_transform')): self._transform = self._transform._as_mpl_transform(self.ax) return self._transform diff --git a/lib/matplotlib/patheffects.py b/lib/matplotlib/patheffects.py index eaaf3d03fd53..30222e66cd93 100644 --- a/lib/matplotlib/patheffects.py +++ b/lib/matplotlib/patheffects.py @@ -10,8 +10,9 @@ import six from matplotlib.backend_bases import RendererBase -from matplotlib import ( - colors as mcolors, patches as mpatches, transforms as mtransforms) +from matplotlib import colors as mcolors +from matplotlib import patches as mpatches +from matplotlib import transforms as mtransforms class AbstractPathEffect(object): diff --git a/lib/matplotlib/tests/test_artist.py b/lib/matplotlib/tests/test_artist.py index 906338cdba18..71b87e5af21a 100644 --- a/lib/matplotlib/tests/test_artist.py +++ b/lib/matplotlib/tests/test_artist.py @@ -11,7 +11,7 @@ import matplotlib.patches as mpatches import matplotlib.lines as mlines import matplotlib.path as mpath -import matplotlib.transforms as mtrans +import matplotlib.transforms as mtransforms import matplotlib.collections as mcollections import matplotlib.artist as martist from matplotlib.testing.decorators import image_comparison @@ -39,13 +39,13 @@ def test_patch_transform_of_none(): transform=None, alpha=0.5) assert e.is_transform_set() is True ax.add_patch(e) - assert isinstance(e._transform, mtrans.IdentityTransform) + assert isinstance(e._transform, mtransforms.IdentityTransform) # Providing an IdentityTransform puts the ellipse in device coordinates. e = mpatches.Ellipse(xy_pix, width=100, height=100, - transform=mtrans.IdentityTransform(), alpha=0.5) + transform=mtransforms.IdentityTransform(), alpha=0.5) ax.add_patch(e) - assert isinstance(e._transform, mtrans.IdentityTransform) + assert isinstance(e._transform, mtransforms.IdentityTransform) # Not providing a transform, and then subsequently "get_transform" should # not mean that "is_transform_set". @@ -84,14 +84,15 @@ def test_collection_transform_of_none(): alpha=0.5) c.set_transform(None) ax.add_collection(c) - assert isinstance(c.get_transform(), mtrans.IdentityTransform) + assert isinstance(c.get_transform(), mtransforms.IdentityTransform) # providing an IdentityTransform puts the ellipse in device coordinates e = mpatches.Ellipse(xy_pix, width=100, height=100) - c = mcollections.PatchCollection([e], transform=mtrans.IdentityTransform(), - alpha=0.5) + c = mcollections.PatchCollection([e], + transform=mtransforms.IdentityTransform(), + alpha=0.5) ax.add_collection(c) - assert isinstance(c._transOffset, mtrans.IdentityTransform) + assert isinstance(c._transOffset, mtransforms.IdentityTransform) @image_comparison(baseline_images=["clip_path_clipping"], remove_text=True) diff --git a/lib/matplotlib/tests/test_legend.py b/lib/matplotlib/tests/test_legend.py index de5650e0f19a..bee550445337 100644 --- a/lib/matplotlib/tests/test_legend.py +++ b/lib/matplotlib/tests/test_legend.py @@ -12,7 +12,7 @@ from matplotlib.testing.decorators import image_comparison import matplotlib.pyplot as plt import matplotlib as mpl -import matplotlib.transforms as mtrans +import matplotlib.transforms as mtransforms import matplotlib.collections as mcollections from matplotlib.legend_handler import HandlerTuple @@ -293,7 +293,7 @@ def test_not_covering_scatter(): extensions=['png']) def test_not_covering_scatter_transform(): # Offsets point to top left, the default auto position - offset = mtrans.Affine2D().translate(-20, 20) + offset = mtransforms.Affine2D().translate(-20, 20) x = np.linspace(0, 30, 1000) plt.plot(x, x) diff --git a/lib/matplotlib/tests/test_patches.py b/lib/matplotlib/tests/test_patches.py index 1c5cc9d5accc..f7722241e47b 100644 --- a/lib/matplotlib/tests/test_patches.py +++ b/lib/matplotlib/tests/test_patches.py @@ -17,7 +17,7 @@ import matplotlib.patches as mpatches import matplotlib.collections as mcollections from matplotlib import path as mpath -from matplotlib import transforms as mtrans +from matplotlib import transforms as mtransforms import matplotlib.style as mstyle import sys @@ -113,7 +113,7 @@ def test_clip_to_bbox(): combined, alpha=0.5, facecolor='coral', edgecolor='none') ax.add_patch(patch) - bbox = mtrans.Bbox([[-12, -77.5], [50, -110]]) + bbox = mtransforms.Bbox([[-12, -77.5], [50, -110]]) result_path = combined.clip_to_bbox(bbox) result_patch = mpatches.PathPatch( result_path, alpha=0.5, facecolor='green', lw=4, edgecolor='black') diff --git a/lib/matplotlib/tests/test_transforms.py b/lib/matplotlib/tests/test_transforms.py index 61d698510140..68c65154aee5 100644 --- a/lib/matplotlib/tests/test_transforms.py +++ b/lib/matplotlib/tests/test_transforms.py @@ -12,14 +12,14 @@ import matplotlib.pyplot as plt import matplotlib.patches as mpatches -import matplotlib.transforms as mtrans +import matplotlib.transforms as mtransforms from matplotlib.path import Path from matplotlib.scale import LogScale from matplotlib.testing.decorators import image_comparison def test_non_affine_caching(): - class AssertingNonAffineTransform(mtrans.Transform): + class AssertingNonAffineTransform(mtransforms.Transform): """ This transform raises an assertion error when called when it shouldn't be and self.raise_on_transform is True. @@ -29,9 +29,9 @@ class AssertingNonAffineTransform(mtrans.Transform): is_affine = False def __init__(self, *args, **kwargs): - mtrans.Transform.__init__(self, *args, **kwargs) + mtransforms.Transform.__init__(self, *args, **kwargs) self.raise_on_transform = False - self.underlying_transform = mtrans.Affine2D().scale(10, 10) + self.underlying_transform = mtransforms.Affine2D().scale(10, 10) def transform_path_non_affine(self, path): assert not self.raise_on_transform, \ @@ -62,7 +62,8 @@ def __init__(self, scale_factor): self._scale_factor = scale_factor def _as_mpl_transform(self, axes): - return mtrans.Affine2D().scale(self._scale_factor) + axes.transData + return (mtransforms.Affine2D().scale(self._scale_factor) + + axes.transData) ax = plt.axes() line, = plt.plot(np.arange(10), transform=ScaledBy(10)) @@ -70,7 +71,7 @@ def _as_mpl_transform(self, axes): ax.set_ylim(0, 100) # assert that the top transform of the line is the scale transform. assert_allclose(line.get_transform()._a.get_matrix(), - mtrans.Affine2D().scale(10).get_matrix()) + mtransforms.Affine2D().scale(10).get_matrix()) @image_comparison(baseline_images=['pre_transform_data'], @@ -80,7 +81,7 @@ def test_pre_transform_plotting(): # pre-transforming the data NOTE: The axis range is important in this # plot. It should be x10 what the data suggests it should be ax = plt.axes() - times10 = mtrans.Affine2D().scale(10) + times10 = mtransforms.Affine2D().scale(10) ax.contourf(np.arange(48).reshape(6, 8), transform=times10 + ax.transData) @@ -114,7 +115,7 @@ def test_contour_pre_transform_limits(): ax = plt.axes() xs, ys = np.meshgrid(np.linspace(15, 20, 15), np.linspace(12.4, 12.5, 20)) ax.contourf(xs, ys, np.log(xs * ys), - transform=mtrans.Affine2D().scale(0.1) + ax.transData) + transform=mtransforms.Affine2D().scale(0.1) + ax.transData) expected = np.array([[1.5, 1.24], [2., 1.25]]) @@ -126,7 +127,7 @@ def test_pcolor_pre_transform_limits(): ax = plt.axes() xs, ys = np.meshgrid(np.linspace(15, 20, 15), np.linspace(12.4, 12.5, 20)) ax.pcolor(xs, ys, np.log(xs * ys), - transform=mtrans.Affine2D().scale(0.1) + ax.transData) + transform=mtransforms.Affine2D().scale(0.1) + ax.transData) expected = np.array([[1.5, 1.24], [2., 1.25]]) @@ -138,7 +139,7 @@ def test_pcolormesh_pre_transform_limits(): ax = plt.axes() xs, ys = np.meshgrid(np.linspace(15, 20, 15), np.linspace(12.4, 12.5, 20)) ax.pcolormesh(xs, ys, np.log(xs * ys), - transform=mtrans.Affine2D().scale(0.1) + ax.transData) + transform=mtransforms.Affine2D().scale(0.1) + ax.transData) expected = np.array([[1.5, 1.24], [2., 1.25]]) @@ -151,32 +152,32 @@ def test_Affine2D_from_values(): [-1, 0], ]) - t = mtrans.Affine2D.from_values(1, 0, 0, 0, 0, 0) + t = mtransforms.Affine2D.from_values(1, 0, 0, 0, 0, 0) actual = t.transform(points) expected = np.array([[0, 0], [10, 0], [-1, 0]]) assert_almost_equal(actual, expected) - t = mtrans.Affine2D.from_values(0, 2, 0, 0, 0, 0) + t = mtransforms.Affine2D.from_values(0, 2, 0, 0, 0, 0) actual = t.transform(points) expected = np.array([[0, 0], [0, 20], [0, -2]]) assert_almost_equal(actual, expected) - t = mtrans.Affine2D.from_values(0, 0, 3, 0, 0, 0) + t = mtransforms.Affine2D.from_values(0, 0, 3, 0, 0, 0) actual = t.transform(points) expected = np.array([[0, 0], [60, 0], [0, 0]]) assert_almost_equal(actual, expected) - t = mtrans.Affine2D.from_values(0, 0, 0, 4, 0, 0) + t = mtransforms.Affine2D.from_values(0, 0, 0, 4, 0, 0) actual = t.transform(points) expected = np.array([[0, 0], [0, 80], [0, 0]]) assert_almost_equal(actual, expected) - t = mtrans.Affine2D.from_values(0, 0, 0, 0, 5, 0) + t = mtransforms.Affine2D.from_values(0, 0, 0, 0, 5, 0) actual = t.transform(points) expected = np.array([[5, 0], [5, 0], [5, 0]]) assert_almost_equal(actual, expected) - t = mtrans.Affine2D.from_values(0, 0, 0, 0, 0, 6) + t = mtransforms.Affine2D.from_values(0, 0, 0, 0, 0, 6) actual = t.transform(points) expected = np.array([[0, 6], [0, 6], [0, 6]]) assert_almost_equal(actual, expected) @@ -190,8 +191,8 @@ def test_clipping_of_log(): path = Path(points, codes) # something like this happens in plotting logarithmic histograms - trans = mtrans.BlendedGenericTransform(mtrans.Affine2D(), - LogScale.Log10Transform('clip')) + trans = mtransforms.BlendedGenericTransform(mtransforms.Affine2D(), + LogScale.Log10Transform('clip')) tpath = trans.transform_path_non_affine(path) result = tpath.iter_segments(trans.get_affine(), clip=(0, 0, 100, 100), @@ -201,7 +202,7 @@ def test_clipping_of_log(): assert_allclose(tcodes, [M, L, L, L, C]) -class NonAffineForTest(mtrans.Transform): +class NonAffineForTest(mtransforms.Transform): """ A class which looks like a non affine transform, but does whatever the given transform does (even if it is affine). This is very useful @@ -214,7 +215,7 @@ class NonAffineForTest(mtrans.Transform): def __init__(self, real_trans, *args, **kwargs): self.real_trans = real_trans - mtrans.Transform.__init__(self, *args, **kwargs) + mtransforms.Transform.__init__(self, *args, **kwargs) def transform_non_affine(self, values): return self.real_trans.transform(values) @@ -226,15 +227,15 @@ def transform_path_non_affine(self, path): class BasicTransformTests(unittest.TestCase): def setUp(self): - self.ta1 = mtrans.Affine2D(shorthand_name='ta1').rotate(np.pi / 2) - self.ta2 = mtrans.Affine2D(shorthand_name='ta2').translate(10, 0) - self.ta3 = mtrans.Affine2D(shorthand_name='ta3').scale(1, 2) + self.ta1 = mtransforms.Affine2D(shorthand_name='ta1').rotate(np.pi / 2) + self.ta2 = mtransforms.Affine2D(shorthand_name='ta2').translate(10, 0) + self.ta3 = mtransforms.Affine2D(shorthand_name='ta3').scale(1, 2) - self.tn1 = NonAffineForTest(mtrans.Affine2D().translate(1, 2), + self.tn1 = NonAffineForTest(mtransforms.Affine2D().translate(1, 2), shorthand_name='tn1') - self.tn2 = NonAffineForTest(mtrans.Affine2D().translate(1, 2), + self.tn2 = NonAffineForTest(mtransforms.Affine2D().translate(1, 2), shorthand_name='tn2') - self.tn3 = NonAffineForTest(mtrans.Affine2D().translate(1, 2), + self.tn3 = NonAffineForTest(mtransforms.Affine2D().translate(1, 2), shorthand_name='tn3') # creates a transform stack which looks like ((A, (N, A)), A) @@ -379,7 +380,8 @@ def test_line_extent_compound_coords1(self): # a simple line in data coordinates in the y component, and in axes # coordinates in the x ax = plt.axes() - trans = mtrans.blended_transform_factory(ax.transAxes, ax.transData) + trans = mtransforms.blended_transform_factory(ax.transAxes, + ax.transData) ax.plot([0.1, 1.2, 0.8], [35, -5, 18], transform=trans) assert_array_equal(ax.dataLim.get_points(), np.array([[np.inf, -5.], @@ -389,7 +391,7 @@ def test_line_extent_compound_coords1(self): def test_line_extent_predata_transform_coords(self): # a simple line in (offset + data) coordinates ax = plt.axes() - trans = mtrans.Affine2D().scale(10) + ax.transData + trans = mtransforms.Affine2D().scale(10) + ax.transData ax.plot([0.1, 1.2, 0.8], [35, -5, 18], transform=trans) assert_array_equal(ax.dataLim.get_points(), np.array([[1., -50.], [12., 350.]])) @@ -399,8 +401,8 @@ def test_line_extent_compound_coords2(self): # a simple line in (offset + data) coordinates in the y component, and # in axes coordinates in the x ax = plt.axes() - trans = mtrans.blended_transform_factory( - ax.transAxes, mtrans.Affine2D().scale(10) + ax.transData) + trans = mtransforms.blended_transform_factory(ax.transAxes, + mtransforms.Affine2D().scale(10) + ax.transData) ax.plot([0.1, 1.2, 0.8], [35, -5, 18], transform=trans) assert_array_equal(ax.dataLim.get_points(), np.array([[np.inf, -50.], [-np.inf, 350.]])) @@ -408,23 +410,23 @@ def test_line_extent_compound_coords2(self): def test_line_extents_affine(self): ax = plt.axes() - offset = mtrans.Affine2D().translate(10, 10) + offset = mtransforms.Affine2D().translate(10, 10) plt.plot(np.arange(10), transform=offset + ax.transData) expected_data_lim = np.array([[0., 0.], [9., 9.]]) + 10 assert_array_almost_equal(ax.dataLim.get_points(), expected_data_lim) def test_line_extents_non_affine(self): ax = plt.axes() - offset = mtrans.Affine2D().translate(10, 10) - na_offset = NonAffineForTest(mtrans.Affine2D().translate(10, 10)) + offset = mtransforms.Affine2D().translate(10, 10) + na_offset = NonAffineForTest(mtransforms.Affine2D().translate(10, 10)) plt.plot(np.arange(10), transform=offset + na_offset + ax.transData) expected_data_lim = np.array([[0., 0.], [9., 9.]]) + 20 assert_array_almost_equal(ax.dataLim.get_points(), expected_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)) + offset = mtransforms.Affine2D().translate(10, 10) + na_offset = NonAffineForTest(mtransforms.Affine2D().translate(10, 10)) pth = Path(np.array([[0, 0], [0, 10], [10, 10], [10, 0]])) patch = mpatches.PathPatch(pth, transform=offset + na_offset + ax.transData) @@ -434,7 +436,7 @@ def test_pathc_extents_non_affine(self): def test_pathc_extents_affine(self): ax = plt.axes() - offset = mtrans.Affine2D().translate(10, 10) + offset = mtransforms.Affine2D().translate(10, 10) pth = Path(np.array([[0, 0], [0, 10], [10, 10], [10, 0]])) patch = mpatches.PathPatch(pth, transform=offset + ax.transData) ax.add_patch(patch) @@ -444,7 +446,7 @@ def test_pathc_extents_affine(self): def test_line_extents_for_non_affine_transData(self): ax = plt.axes(projection='polar') # add 10 to the radius of the data - offset = mtrans.Affine2D().translate(0, 10) + offset = mtransforms.Affine2D().translate(0, 10) plt.plot(np.arange(10), transform=offset + ax.transData) # the data lim of a polar plot is stored in coordinates @@ -459,8 +461,8 @@ def assert_bbox_eq(bbox1, bbox2): def test_bbox_intersection(): - bbox_from_ext = mtrans.Bbox.from_extents - inter = mtrans.Bbox.intersection + bbox_from_ext = mtransforms.Bbox.from_extents + inter = mtransforms.Bbox.intersection r1 = bbox_from_ext(0, 0, 1, 1) r2 = bbox_from_ext(0.5, 0.5, 1.5, 1.5) @@ -481,8 +483,8 @@ def test_bbox_intersection(): def test_bbox_as_strings(): - b = mtrans.Bbox([[.5, 0], [.75, .75]]) - assert_bbox_eq(b, eval(repr(b), {'Bbox': mtrans.Bbox})) + b = mtransforms.Bbox([[.5, 0], [.75, .75]]) + assert_bbox_eq(b, eval(repr(b), {'Bbox': mtransforms.Bbox})) asdict = eval(str(b), {'Bbox': dict}) for k, v in asdict.items(): assert getattr(b, k) == v @@ -493,7 +495,7 @@ def test_bbox_as_strings(): def test_transform_single_point(): - t = mtrans.Affine2D() + t = mtransforms.Affine2D() r = t.transform_affine((1, 1)) assert r.shape == (2,) @@ -507,13 +509,13 @@ def test_log_transform(): def test_nan_overlap(): - a = mtrans.Bbox([[0, 0], [1, 1]]) - b = mtrans.Bbox([[0, 0], [1, np.nan]]) + a = mtransforms.Bbox([[0, 0], [1, 1]]) + b = mtransforms.Bbox([[0, 0], [1, np.nan]]) assert not a.overlaps(b) def test_transform_angles(): - t = mtrans.Affine2D() # Identity transform + t = mtransforms.Affine2D() # Identity transform angles = np.array([20, 45, 60]) points = np.array([[0, 0], [1, 1], [2, 2]]) @@ -535,12 +537,12 @@ def test_nonsingular(): zero_expansion = np.array([-0.001, 0.001]) cases = [(0, np.nan), (0, 0), (0, 7.9e-317)] for args in cases: - out = np.array(mtrans.nonsingular(*args)) + out = np.array(mtransforms.nonsingular(*args)) assert_array_equal(out, zero_expansion) def test_invalid_arguments(): - t = mtrans.Affine2D() + t = mtransforms.Affine2D() # There are two different exceptions, since the wrong number of # dimensions is caught when constructing an array_view, and that # raises a ValueError, and a wrong shape with a possible number @@ -565,8 +567,8 @@ def test_transformed_path(): codes = [Path.MOVETO, Path.LINETO, Path.LINETO, Path.CLOSEPOLY] path = Path(points, codes) - trans = mtrans.Affine2D() - trans_path = mtrans.TransformedPath(path, trans) + trans = mtransforms.Affine2D() + trans_path = mtransforms.TransformedPath(path, trans) assert_allclose(trans_path.get_fully_transformed_path().vertices, points) # Changing the transform should change the result. @@ -584,10 +586,10 @@ def test_transformed_path(): def test_transformed_patch_path(): - trans = mtrans.Affine2D() + trans = mtransforms.Affine2D() patch = mpatches.Wedge((0, 0), 1, 45, 135, transform=trans) - tpatch = mtrans.TransformedPatchPath(patch) + tpatch = mtransforms.TransformedPatchPath(patch) points = tpatch.get_fully_transformed_path().vertices # Changing the transform should change the result.