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

Commit f5e7b21

Browse filesBrowse files
committed
Standardized matplotlib transforms import
from "as mtrans" into "as mtransforms"
1 parent 38fb846 commit f5e7b21
Copy full SHA for f5e7b21

File tree

Expand file treeCollapse file tree

8 files changed

+79
-78
lines changed
Filter options
Expand file treeCollapse file tree

8 files changed

+79
-78
lines changed

‎examples/pylab_examples/transoffset.py

Copy file name to clipboardExpand all lines: examples/pylab_examples/transoffset.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
'''
1717

1818
import matplotlib.pyplot as plt
19-
import matplotlib.transforms as mtrans
19+
import matplotlib.transforms as mtransforms
2020
import numpy as np
2121

2222
from matplotlib.transforms import offset_copy
@@ -31,8 +31,8 @@
3131
# we only need to make one transform. To get the
3232
# transform argument to offset_copy, we need to make the axes
3333
# first; the subplot command above is one way to do this.
34-
trans_offset = mtrans.offset_copy(ax.transData, fig=fig,
35-
x=0.05, y=0.10, units='inches')
34+
trans_offset = mtransforms.offset_copy(ax.transData, fig=fig,
35+
x=0.05, y=0.10, units='inches')
3636

3737
for x, y in zip(xs, ys):
3838
plt.plot((x,), (y,), 'ro')
@@ -42,7 +42,7 @@
4242
# offset_copy works for polar plots also.
4343
ax = plt.subplot(2, 1, 2, projection='polar')
4444

45-
trans_offset = mtrans.offset_copy(ax.transData, fig=fig, y=6, units='dots')
45+
trans_offset = mtransforms.offset_copy(ax.transData, fig=fig, y=6, units='dots')
4646

4747
for x, y in zip(xs, ys):
4848
plt.polar((x,), (y,), 'ro')

‎lib/matplotlib/colorbar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/colorbar.py
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import matplotlib.patches as mpatches
4040
import matplotlib.path as mpath
4141
import matplotlib.ticker as ticker
42-
import matplotlib.transforms as mtrans
42+
import matplotlib.transforms as mtransforms
4343

4444
from matplotlib import docstring
4545

@@ -687,9 +687,9 @@ def _process_values(self, b=None):
687687
self.norm.vmin = 0
688688
self.norm.vmax = 1
689689

690-
self.norm.vmin, self.norm.vmax = mtrans.nonsingular(self.norm.vmin,
691-
self.norm.vmax,
692-
expander=0.1)
690+
self.norm.vmin, self.norm.vmax = mtransforms.nonsingular(self.norm.vmin,
691+
self.norm.vmax,
692+
expander=0.1)
693693

694694
b = self.norm.inverse(self._uniform_y(self.cmap.N + 1))
695695

@@ -1126,8 +1126,8 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15,
11261126
'parents share the same figure.')
11271127

11281128
# take a bounding box around all of the given axes
1129-
parents_bbox = mtrans.Bbox.union([ax.get_position(original=True).frozen()
1130-
for ax in parents])
1129+
parents_bbox = mtransforms.Bbox.union([ax.get_position(original=True).frozen()
1130+
for ax in parents])
11311131

11321132
pb = parents_bbox
11331133
if location in ('left', 'right'):
@@ -1148,12 +1148,12 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15,
11481148

11491149
# define a transform which takes us from old axes coordinates to
11501150
# new axes coordinates
1151-
shrinking_trans = mtrans.BboxTransform(parents_bbox, pb1)
1151+
shrinking_trans = mtransforms.BboxTransform(parents_bbox, pb1)
11521152

11531153
# transform each of the axes in parents using the new transform
11541154
for ax in parents:
11551155
new_posn = shrinking_trans.transform(ax.get_position())
1156-
new_posn = mtrans.Bbox(new_posn)
1156+
new_posn = mtransforms.Bbox(new_posn)
11571157
ax.set_position(new_posn)
11581158
if parent_anchor is not False:
11591159
ax.set_anchor(parent_anchor)

‎lib/matplotlib/contour.py

Copy file name to clipboardExpand all lines: lib/matplotlib/contour.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import matplotlib.mathtext as mathtext
2727
import matplotlib.patches as mpatches
2828
import matplotlib.texmanager as texmanager
29-
import matplotlib.transforms as mtrans
29+
import matplotlib.transforms as mtransforms
3030
from matplotlib.cbook import mplDeprecation
3131

3232
# Import needed for adding manual selection capability to clabel
@@ -967,7 +967,7 @@ def get_transform(self):
967967
"""
968968
if self._transform is None:
969969
self._transform = self.ax.transData
970-
elif (not isinstance(self._transform, mtrans.Transform)
970+
elif (not isinstance(self._transform, mtransforms.Transform)
971971
and hasattr(self._transform, '_as_mpl_transform')):
972972
self._transform = self._transform._as_mpl_transform(self.ax)
973973
return self._transform

‎lib/matplotlib/patheffects.py

Copy file name to clipboardExpand all lines: lib/matplotlib/patheffects.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
import six
1111

1212
from matplotlib.backend_bases import RendererBase
13-
from matplotlib import (
14-
colors as mcolors, patches as mpatches, transforms as mtransforms)
13+
from matplotlib import colors as mcolors
14+
from matplotlib import patches as mpatches
15+
from matplotlib import transforms as mtransforms
1516

1617

1718
class AbstractPathEffect(object):

‎lib/matplotlib/tests/test_artist.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_artist.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import matplotlib.patches as mpatches
1212
import matplotlib.lines as mlines
1313
import matplotlib.path as mpath
14-
import matplotlib.transforms as mtrans
14+
import matplotlib.transforms as mtransforms
1515
import matplotlib.collections as mcollections
1616
import matplotlib.artist as martist
1717
from matplotlib.testing.decorators import image_comparison
@@ -39,13 +39,13 @@ def test_patch_transform_of_none():
3939
transform=None, alpha=0.5)
4040
assert e.is_transform_set() is True
4141
ax.add_patch(e)
42-
assert isinstance(e._transform, mtrans.IdentityTransform)
42+
assert isinstance(e._transform, mtransforms.IdentityTransform)
4343

4444
# Providing an IdentityTransform puts the ellipse in device coordinates.
4545
e = mpatches.Ellipse(xy_pix, width=100, height=100,
46-
transform=mtrans.IdentityTransform(), alpha=0.5)
46+
transform=mtransforms.IdentityTransform(), alpha=0.5)
4747
ax.add_patch(e)
48-
assert isinstance(e._transform, mtrans.IdentityTransform)
48+
assert isinstance(e._transform, mtransforms.IdentityTransform)
4949

5050
# Not providing a transform, and then subsequently "get_transform" should
5151
# not mean that "is_transform_set".
@@ -84,14 +84,14 @@ def test_collection_transform_of_none():
8484
alpha=0.5)
8585
c.set_transform(None)
8686
ax.add_collection(c)
87-
assert isinstance(c.get_transform(), mtrans.IdentityTransform)
87+
assert isinstance(c.get_transform(), mtransforms.IdentityTransform)
8888

8989
# providing an IdentityTransform puts the ellipse in device coordinates
9090
e = mpatches.Ellipse(xy_pix, width=100, height=100)
91-
c = mcollections.PatchCollection([e], transform=mtrans.IdentityTransform(),
91+
c = mcollections.PatchCollection([e], transform=mtransforms.IdentityTransform(),
9292
alpha=0.5)
9393
ax.add_collection(c)
94-
assert isinstance(c._transOffset, mtrans.IdentityTransform)
94+
assert isinstance(c._transOffset, mtransforms.IdentityTransform)
9595

9696

9797
@image_comparison(baseline_images=["clip_path_clipping"], remove_text=True)

‎lib/matplotlib/tests/test_legend.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_legend.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from matplotlib.testing.decorators import image_comparison
1313
import matplotlib.pyplot as plt
1414
import matplotlib as mpl
15-
import matplotlib.transforms as mtrans
15+
import matplotlib.transforms as mtransforms
1616
import matplotlib.collections as mcollections
1717
from matplotlib.legend_handler import HandlerTuple
1818

@@ -293,7 +293,7 @@ def test_not_covering_scatter():
293293
extensions=['png'])
294294
def test_not_covering_scatter_transform():
295295
# Offsets point to top left, the default auto position
296-
offset = mtrans.Affine2D().translate(-20, 20)
296+
offset = mtransforms.Affine2D().translate(-20, 20)
297297
x = np.linspace(0, 30, 1000)
298298
plt.plot(x, x)
299299

‎lib/matplotlib/tests/test_patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_patches.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import matplotlib.patches as mpatches
1818
import matplotlib.collections as mcollections
1919
from matplotlib import path as mpath
20-
from matplotlib import transforms as mtrans
20+
from matplotlib import transforms as mtransforms
2121
import matplotlib.style as mstyle
2222

2323
import sys
@@ -113,7 +113,7 @@ def test_clip_to_bbox():
113113
combined, alpha=0.5, facecolor='coral', edgecolor='none')
114114
ax.add_patch(patch)
115115

116-
bbox = mtrans.Bbox([[-12, -77.5], [50, -110]])
116+
bbox = mtransforms.Bbox([[-12, -77.5], [50, -110]])
117117
result_path = combined.clip_to_bbox(bbox)
118118
result_patch = mpatches.PathPatch(
119119
result_path, alpha=0.5, facecolor='green', lw=4, edgecolor='black')

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.