8000 Removed transforms on the C++ side -- removed many methods that depend · matplotlib/matplotlib@7376a55 · GitHub
[go: up one dir, main page]

Skip to content
10000

Commit 7376a55

Browse files
committed
Removed transforms on the C++ side -- removed many methods that depend
on it in backend_agg in preparation for path generalization. Lots of general renaming... svn path=/branches/transforms/; revision=3851
1 parent beeca68 commit 7376a55

21 files changed

+186
-4097
lines changed

lib/matplotlib/artist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import division
22
import sys, re
33
from cbook import iterable, flatten
4-
from affine import Affine2D
4+
from transforms import Affine2D
55
import matplotlib.units as units
66

77
## Note, matplotlib artists use the doc strings for set and get

lib/matplotlib/axes.py

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
rcParams = matplotlib.rcParams
1010

1111
from matplotlib import artist as martist
12-
from matplotlib import affine as maffine
1312
from matplotlib import agg
1413
from matplotlib import axis as maxis
1514
from matplotlib import cbook
@@ -29,6 +28,7 @@
2928
from matplotlib import table as mtable
3029
from matplotlib import text as mtext
3130
from matplotlib import ticker as mticker
31+
from matplotlib import transforms as mtransforms
3232

3333
iterable = cbook.iterable
3434
is_string_like = cbook.is_string_like
@@ -481,7 +481,7 @@ def __init__(self, fig, rect,
481481
482482
"""
483483
martist.Artist.__init__(self)
484-
self._position = maffine.Bbox.from_lbwh(*rect)
484+
self._position = mtransforms.Bbox.from_lbwh(*rect)
485485
self._originalPosition = copy.deepcopy(self._position)
486486
self.set_axes(self)
487487
self.set_aspect('auto')
@@ -612,7 +612,7 @@ def set_figure(self, fig):
612612
"""
613613
martist.Artist.set_figure(self, fig)
614614

615-
self.bbox = maffine.TransformedBbox(self._position, fig.transFigure)
615+
self.bbox = mtransforms.TransformedBbox(self._position, fig.transFigure)
616616
#these will be updated later as data is added
617617
self._set_lim_and_transforms()
618618

@@ -631,7 +631,7 @@ def _set_lim_and_transforms(self):
631631
set the dataLim and viewLim BBox attributes and the
632632
transData and transAxes Transformation attributes
633633
"""
634-
Bbox = maffine.Bbox
634+
Bbox = mtransforms.Bbox
635635
self.viewLim = Bbox.unit()
636636

637637
if self._sharex is not None:
@@ -647,20 +647,11 @@ def _set_lim_and_transforms(self):
647647

648648
self.dataLim = Bbox.unit()
649649

650-
self.transAxes = maffine.BboxTransform(
650+
self.transAxes = mtransforms.BboxTransform(
651651
Bbox.unit(), self.bbox)
652652

653-
localTransData = maffine.BboxTransform(
653+
self.transData = mtransforms.BboxTransform(
654654
self.viewLim, self.bbox)
655-
if self._sharex:
656-
transDataX = self._sharex.transData
657-
else:
658-
transDataX = localTransData
659-
if self._sharey:
660-
transDataY = self._sharey.transData
661-
else:
662-
transDataY = localTransData
663-
self.transData = localTransData # maffine.blend_xy_sep_transform(transDataX, transDataY)
664655

665656

666657
def get_position(self, original=False):
@@ -1538,7 +1529,7 @@ def set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs):
15381529
# and min(xmin, xmax)<=0):
15391530
# raise ValueError('Cannot set nonpositive limits with log transform')
15401531

1541-
xmin, xmax = maffine.nonsingular(xmin, xmax, increasing=False)
1532+
xmin, xmax = mtransforms.nonsingular(xmin, xmax, increasing=False)
15421533

15431534
self.viewLim.intervalx = (xmin, xmax)
15441535
if emit:
@@ -1670,7 +1661,7 @@ def set_ylim(self, ymin=None, ymax=None, emit=True, **kwargs):
16701661
# and min(ymin, ymax)<=0):
16711662
# raise ValueError('Cannot set nonpositive limits with log transform')
16721663

1673-
ymin, ymax = maffine.nonsingular(ymin, ymax, increasing=False)
1664+
ymin, ymax = mtransforms.nonsingular(ymin, ymax, increasing=False)
16741665
self.viewLim.intervaly = (ymin, ymax)
16751666
if emit:
16761667
self.callbacks.process('ylim_changed', self)
@@ -2167,7 +2158,7 @@ def annotate(self, *args, **kwargs):
21672158
%(Annotation)s
21682159
"""
21692160
a = mtext.Annotation(*args, **kwargs)
2170-
a.set_transform(maffine.Affine2D())
2161+
a.set_transform(mtransforms.Affine2D())
21712162
self._set_artist_props(a)
21722163
if kwargs.has_key('clip_on'): a.set_clip_box(self.bbox)
21732164
self.texts.append(a)
@@ -2206,7 +2197,7 @@ def axhline(self, y=0, xmin=0, xmax=1, **kwargs):
22062197
%(Line2D)s
22072198
"""
22082199

2209-
trans = maffine.blend_xy_sep_transform(self.transAxes, self.transData)
2200+
trans = mtransforms.blend_xy_sep_transform(self.transAxes, self.transData)
22102201
l, = self.plot([xmin,xmax], [y,y], transform=trans, scalex=False, **kwargs)
22112202
return l
22122203

@@ -2242,7 +2233,7 @@ def axvline(self, x=0, ymin=0, ymax=1, **kwargs):
22422233
%(Line2D)s
22432234
"""
22442235

2245-
trans = maffine.blend_xy_sep_transform( self.transData, self.transAxes )
2236+
trans = mtransforms.blend_xy_sep_transform( self.transData, self.transAxes )
22462237
l, = self.plot([x,x], [ymin,ymax] , transform=trans, scaley=False, **kwargs)
22472238
return l
22482239

@@ -2281,7 +2272,7 @@ def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
22812272
%(Polygon)s
22822273
"""
22832274
# convert y axis units
2284-
trans = maffine.blend_xy_sep_transform( self.transAxes, self.transData)
2275+
trans = mtransforms.blend_xy_sep_transform( self.transAxes, self.transData)
22852276
verts = (xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)
22862277
p = mpatches.Polygon(verts, **kwargs)
22872278
p.set_transform(trans)
@@ -2321,7 +2312,7 @@ def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
23212312
%(Polygon)s
23222313
"""
23232314
# convert x axis units
2324-
trans = maffine.blend_xy_sep_transform(self.transData, self.transAxes)
2315+
trans = mtransforms.blend_xy_sep_transform(self.transData, self.transAxes)
23252316
verts = [(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)]
23262317
p = mpatches.Polygon(verts, **kwargs)
23272318
p.set_transform(trans)
@@ -4104,7 +4095,7 @@ def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
41044095
offsets = zip(x,y),
41054096
transOffset = self.transData,
41064097
)
4107-
collection.set_transform(maffine.Affine2D())
4098+
collection.set_transform(mtransforms.Affine2D())
41084099
collection.set_alpha(alpha)
41094100
collection.update(kwargs)
41104101

lib/matplotlib/axis.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
from ticker import NullFormatter, FixedFormatter, ScalarFormatter, LogFormatter
1616
from ticker import NullLocator, FixedLocator, LinearLocator, LogLocator, AutoLocator
1717

18-
from affine import Affine2D, Bbox, blend_xy_sep_transform, interval_contains, \
19-
interval_contains_open
2018
from font_manager import FontProperties
2119
from text import Text, TextWithDash, _process_text_args
20+
from transforms import Affine2D, Bbox, blended_transform_factory, interval_contains, \
21+
interval_contains_open
2222
from patches import bbox_artist
2323

2424
import matplotlib.units as units
@@ -236,7 +236,7 @@ def _get_text1(self, loc):
236236
xaxis=True,
237237
)
238238

239-
trans = blend_xy_sep_transform(
239+
trans = blended_transform_factory(
240240
self.axes.transData, self.axes.transAxes)
241241
#offset the text downward with a post transformation
242242
trans = trans + Affine2D().translate(0, -1 * self._padPixels)
@@ -261,7 +261,7 @@ def _get_text2(self, loc):
261261
horizontalalignment='center',
262262
)
263263

264-
trans = blend_xy_sep_transform(
264+
trans = blended_transform_factory(
265265
self.axes.transData, self.axes.transAxes)
266266
# offset the text upward with a post transformation
267267
trans = trans + Affine2D().translate(0, self._padPixels)
@@ -279,7 +279,7 @@ def _get_tick1line(self, loc):
279279
marker = self._xtickmarkers[0],
280280
markersize=self._size,
281281
)
282-
l.set_transform(blend_xy_sep_transform(
282+
l.set_transform(blended_transform_factory(
283283
self.axes.transData, self.axes.transAxes) )
284284
self._set_artist_props(l)
285285
return l
@@ -295,7 +295,7 @@ def _get_tick2line(self, loc):
295295
markersize=self._size,
296296
)
297297

298-
l.set_transform(blend_xy_sep_transform(
298+
l.set_transform(blended_transform_factory(
299299
self.axes.transData, self.axes.transAxes) )
300300
self._set_artist_props(l)
301301
return l
@@ -310,7 +310,7 @@ def _get_gridline(self, loc):
310310
antialiased=False,
311311
)
312312
l.set_transform(
313-
blend_xy_sep_transform(
313+
blended_transform_factory(
314314
self.axes.transData, self.axes.transAxes))
315315
l.set_clip_box(self.axes.bbox)
316316
self._set_artist_props(l)
@@ -359,7 +359,7 @@ def _get_text1(self, loc):
359359
dashdirection=0,
360360
xaxis=False,
361361
)
362-
trans = blend_xy_sep_transform(
362+
trans = blended_transform_factory(
363363
self.axes.transAxes, self.axes.transData)
364364
# offset the text leftward with a post transformation
365365
trans = trans + Affine2D().translate(-1 * self._padPixels, 0)
@@ -382,7 +382,7 @@ def _get_text2(self, loc):
382382
xaxis=False,
383383
horizontalalignment='left',
384384
)
385-
trans = blend_xy_sep_transform(
385+
trans = blended_transform_factory(
386386
self.axes.transAxes, self.axes.transData)
387387
# offset the text rightward with a post transformation
388388
trans = trans + Affine2D().translate(self._padPixels, 0)
@@ -401,7 +401,7 @@ def _get_tick1line(self, loc):
401401
markersize=self._size,
402402
)
403403
l.set_transform(
404-
blend_xy_sep_transform(
404+
blended_transform_factory(
405405
self.axes.transAxes, self.axes.transData))
406406
self._set_artist_props(l)
407407
return l
@@ -417,7 +417,7 @@ def _get_tick2line(self, loc):
417417
)
418418

419419
l.set_transform(
420-
blend_xy_sep_transform(
420+
blended_transform_factory(
421421
self.axes.transAxes, self.axes.transData))
422422
self._set_artist_props(l)
423423
return l
@@ -432,7 +432,7 @@ def _get_gridline(self, loc):
432432
antialiased=False,
433433
)
434434

435-
l.set_transform( blend_xy_sep_transform(
435+
l.set_transform( blended_transform_factory(
436436
self.axes.transAxes, self.axes.transData) )
437437
l.set_clip_box(self.axes.bbox)
438438

@@ -979,7 +979,7 @@ def _get_label(self):
979979
verticalalignment='top',
980980
horizontalalignment='center',
981981
)
982-
label.set_transform( blend_xy_sep_transform(
982+
label.set_transform( blended_transform_factory(
983983
self.axes.transAxes, Affine2D() ))
984984

985985
self._set_artist_props(label)
@@ -994,7 +994,7 @@ def _get_offset_text(self):
994994
verticalalignment='top',
995995
horizontalalignment='right',
996996
)
997-
offsetText.set_transform( blend_xy_sep_transform(
997+
offsetText.set_transform( blended_transform_factory(
998998
self.axes.transAxes, Affine2D() ))
999999
self._set_artist_props(offsetText)
10001000
self.offset_text_position='bottom'
@@ -1169,7 +1169,7 @@ def _get_label(self):
11691169
horizontalalignment='right',
11701170
rotation='vertical',
11711171
)
1172-
label.set_transform( blend_xy_sep_transform(
1172+
label.set_transform( blended_transform_factory(
11731173
Affine2D(), self.axes.transAxes) )
11741174

11751175
self._set_artist_props(label)
@@ -1184,7 +1184,7 @@ def _get_offset_text(self):
11841184
verticalalignment = 'bottom',
11851185
horizontalalignment = 'left',
11861186
)
1187-
offsetText.set_transform(blend_xy_sep_transform(
1187+
offsetText.set_transform(blended_transform_factory(
11881188
self.axes.transAxes, Affine2D()) )
11891189
self._set_artist_props(offsetText)
11901190
self.offset_text_position='left'

lib/matplotlib/backends/backend_agg.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
from matplotlib.font_manager import findfont
8585
from matplotlib.ft2font import FT2Font, LOAD_DEFAULT
8686
from matplotlib.mathtext import MathTextParser
87-
from matplotlib.affine import Bbox
87+
from matplotlib.transforms import Bbox
8888

8989
from _backend_agg import RendererAgg as _RendererAgg
9090

@@ -115,15 +115,10 @@ def __init__(self, width, height, dpi):
115115
'debug-annoying')
116116
# self.draw_polygon = self._renderer.draw_polygon
117117
self.draw_rectangle = self._renderer.draw_rectangle
118-
self.draw_path = self._renderer.draw_path
119118
# MGDTODO -- remove these lines
120119
# self.draw_lines = self._renderer.draw_lines
121120
# self.draw_markers = self._renderer.draw_markers
122121
self.draw_image = self._renderer.draw_image
123-
self.draw_line_collection = self._renderer.draw_line_collection
124-
self.draw_quad_mesh = self._renderer.draw_quad_mesh
125-
self.draw_poly_collection = self._renderer.draw_poly_collection
126-
self.draw_regpoly_collection = self._renderer.draw_regpoly_collection
127122

128123
self.copy_from_bbox = self._renderer.copy_from_bbox
129124
self.restore_region = self._renderer.restore_region

lib/matplotlib/figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
from text import Text, _process_text_args
1919

2020
from legend import Legend
21-
from affine import Affine2D, Bbox, BboxTransform, TransformedBbox
2221
from ticker import FormatStrFormatter
22+
from transforms import Affine2D, Bbox, BboxTransform, TransformedBbox
2323
from cm import ScalarMappable
2424
from contour import ContourSet
2525
import warnings

lib/matplotlib/finance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from matplotlib.colors import colorConverter
2323
from lines import Line2D, TICKLEFT, TICKRIGHT
2424
from patches import Rectangle
25-
from matplotlib.affine import Affine2D
25+
from matplotlib.transforms import Affine2D
2626

2727

2828

lib/matplotlib/legend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from patches import Patch, Rectangle, RegularPolygon, Shadow, bbox_artist, draw_bbox
3535
from collections import LineCollection, RegularPolyCollection, PatchCollection
3636
from text import Text
37-
from affine import Bbox, BboxTransform
37+
from transforms import Bbox, BboxTransform
3838

3939
def line_cuts_bbox(line, bbox):
4040
""" Return True if and only if line cuts bbox. """

lib/matplotlib/lines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
import numerix.ma as ma
1515
from matplotlib import verbose
1616
import artist
17-
from affine import Bbox
1817
from artist import Artist, setp
1918
from cbook import iterable, is_string_like, is_numlike
2019
from colors import colorConverter
20+
from transforms import Bbox
2121

2222
from matplotlib import rcParams
2323

lib/matplotlib/table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from patches import Rectangle
3030
from cbook import enumerate, is_string_like, flatten
3131
from text import Text
32-
from affine import Bbox
32+
from transforms import Bbox
3333

3434

3535

lib/matplotlib/text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from cbook import enumerate, is_string_like, maxdict, is_numlike
1616
from font_manager import FontProperties
1717
from patches import bbox_artist, YAArrow
18-
from affine import Affine2D, Bbox
18+
from transforms import Affine2D, Bbox
1919
from lines import Line2D
2020

2121
import matplotlib.nxutils as nxutils

0 commit comments

Comments
 (0)
0