Skip to content

Renamed all 'mtrans' into more common 'mtransforms' #8338

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 5 commits into from
Mar 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions examples/pylab_examples/transoffset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
Expand All @@ -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')
Expand Down
5 changes: 2 additions & 3 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
17 changes: 9 additions & 8 deletions lib/matplotlib/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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))

Expand Down Expand Up @@ -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'):
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions lib/matplotlib/patheffects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
17 changes: 9 additions & 8 deletions lib/matplotlib/tests/test_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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".
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/tests/test_legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/tests/test_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down
Loading