Skip to content

Commit 52d462f

Browse files
committed
table_demo working. Lots of minor fixes. Faster transforms when
debugging is turned off. svn path=/branches/transforms/; revision=4000
1 parent e8124d7 commit 52d462f

File tree

11 files changed

+82
-54
lines changed

11 files changed

+82
-54
lines changed

PASSED_DEMOS

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,13 @@ polar_bar.py O
156156
polar_demo.py O
157157
polar_legend.py O
158158
polar_scatter.py O
159-
poly_editor.py [NEEDS OVERHAUL]
159+
poly_editor.py O
160160
poormans_contour.py O
161-
printing_in_wx.py
161+
printing_in_wx.py [REQUIRES NON-AGG WX RENDERER, WHICH IS NOT YET IMPLEMENTED]
162162
print_stdout.py [BROKEN?]
163163
psd_demo.py O
164-
pstest.py
165-
pylab_with_gtk.py
164+
pstest.py O
165+
pylab_with_gtk.py O
166166
pythonic_matplotlib.py O
167167
quadmesh_demo.py O [MASKED VALUES ARE SHOWN DUE TO A BUG IN TRUNK]
168168
quiver_demo.py O
@@ -190,7 +190,7 @@ subplot_demo.py O
190190
subplots_adjust.py O
191191
subplot_toolbar.py O
192192
system_monitor.py O
193-
table_demo.py
193+
table_demo.py O
194194
tex_demo.py O
195195
text_handles.py O
196196
text_rotation.py O
@@ -204,7 +204,7 @@ unicode_demo.py O
204204
vertical_ticklabels.py O
205205
vline_demo.py O
206206
webapp_demo.py
207-
wxcursor_demo.py
207+
wxcursor_demo.py O
208208
xcorr_demo.py O
209209
zoom_window.py O
210210
zorder_demo.py O

examples/contour_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@
9292
# This makes the original colorbar look a bit out of place,
9393
# so let's improve its position.
9494

95-
l,b,w,h = gca().get_position()
96-
ll,bb,ww,hh = CB.ax.get_position()
95+
l,b,w,h = gca().get_position().bounds
96+
ll,bb,ww,hh = CB.ax.get_position().bounds
9797
CB.ax.set_position([ll, b+0.1*h, ww, h*0.8])
9898

9999

lib/matplotlib/axes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,6 @@ def _set_lim_and_transforms(self):
582582
self._yaxis_transform = mtransforms.blended_transform_factory(
583583
self.axes.transAxes, self.axes.transData)
584584

585-
self.transData.write_graphviz(open("trans.dot", "w"))
586-
587585
def get_xaxis_transform(self):
588586
return self._xaxis_transform
589587

@@ -636,8 +634,10 @@ def set_position(self, pos, which='both'):
636634
'original' to change the second;
637635
'both' to change both
638636
639-
ACCEPTS: len(4) sequence of floats
637+
ACCEPTS: len(4) sequence of floats, or a Bbox object
640638
"""
639+
if not isinstance(pos, mtransforms.BboxBase):
640+
pos = mtransforms.Bbox.from_bounds(*pos)
641641
if which in ('both', 'active'):
642642
self._position.set(pos)
643643
if which in ('both', 'original'):

lib/matplotlib/backend_bases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def _iter_collection(self, path_ids, cliprect, clippath, clippath_trans,
155155
gc.set_clip_rectangle(cliprect)
156156
if clippath is not None:
157157
clippath = transforms.TransformedPath(clippath, clippath_trans)
158-
gc.set_clippath(clippath)
158+
gc.set_clip_path(clippath)
159159

160160
if Nfacecolors == 0:
161161
rgbFace = None

lib/matplotlib/backends/backend_pdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ def markerObject(self, path, trans, fillp, lw):
10321032
def writeMarkers(self):
10331033
for tup in self.markers.values():
10341034
name, object, path, trans, fillp, lw = tup
1035-
bbox = Bbox.from_extents(*path.get_extents(trans))
1035+
bbox = path.get_extents(trans)
10361036
bbox = bbox.padded(lw * 0.5)
10371037
self.beginStream(
10381038
object.id, None,

lib/matplotlib/backends/backend_ps.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,6 @@ def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None):
402402
clipx,clipy,clipw,cliph = bbox.bounds
403403
clip.append('%s clipbox' % _nums_to_str(clipw, cliph, clipx, clipy))
404404
if clippath is not None:
405-
print "clippath"
406405
id = self._get_clip_path(clippath, clippath_trans)
407406
clip.append('%s' % id)
408407
clip = '\n'.join(clip)

lib/matplotlib/lines.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,6 @@ def draw(self, renderer):
448448
renderer.open_group('line2d')
449449

450450
if not self._visible: return
451-
self._newstyle = hasattr(renderer, 'draw_markers')
452451
gc = renderer.new_gc()
453452
self._set_gc_clip(gc)
454453

lib/matplotlib/patches.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def update_from(self, other):
102102
self.set_fill(other.get_fill())
103103
self.set_hatch(other.get_hatch())
104104
self.set_linewidth(other.get_linewidth())
105-
self.set_transform(other.get_transform())
105+
self.set_transform(other.get_data_transform())
106106
self.set_figure(other.get_figure())
107107
self.set_alpha(other.get_alpha())
108108

lib/matplotlib/scale.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ class Log10Transform(Transform):
4242
is_separable = True
4343

4444
def transform(self, a):
45-
# MGDTODO: Remove me
46-
if len(a) > 10:
47-
print "log transforming"
4845
return ma.log10(ma.masked_where(a <= 0.0, a * 10.0))
4946

5047
def inverted(self):

lib/matplotlib/table.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ def get_text(self):
7575
return self._text
7676

7777
def set_fontsize(self, size):
78-
7978
self._text.set_fontsize(size)
8079

8180
def get_fontsize(self):
@@ -108,7 +107,7 @@ def _set_text_position(self, renderer):
108107
Currently support 'left', 'center' and 'right'
109108
"""
110109
bbox = self.get_window_extent(renderer)
111-
l, b, w, h = bbox.get_bounds()
110+
l, b, w, h = bbox.bounds
112111

113112
# draw in center vertically
114113
self._text.set_verticalalignment('center')
@@ -130,8 +129,8 @@ def _set_text_position(self, renderer):
130129
def get_text_bounds(self, renderer):
131130
""" Get text bounds in axes co-ordinates. """
132131
bbox = self._text.get_window_extent(renderer)
133-
bboxa = bbox.inverse_transformed(self.get_transform())
134-
return bboxa.get_bounds()
132+
bboxa = bbox.inverse_transformed(self.get_data_transform())
133+
return bboxa.bounds
135134

136135
def get_required_width(self, renderer):
137136
""" Get width required for this cell. """
@@ -246,8 +245,8 @@ def _get_grid_bbox(self, renderer):
246245
for pos in self._cells.keys()
247246
if pos[0] >= 0 and pos[1] >= 0]
248247

249-
bbox = bbox_all(boxes)
250-
return inverse_transform_bbox(self.get_transform(), bbox)
248+
bbox = Bbox.union(boxes)
249+
return bbox.inverse_transformed(self.get_transform())
251250

252251
def contains(self,mouseevent):
253252
"""Test whether the mouse event occurred in the table.
@@ -393,7 +392,7 @@ def _update_positions(self, renderer):
393392
self._do_cell_alignment()
394393

395394
bbox = self._get_grid_bbox(renderer)
396-
l,b,w,h = bbox.get_bounds()
395+
l,b,w,h = bbox.bounds
397396

398397
if self._bbox is not None:
399398
# Position according to bbox
@@ -530,7 +529,7 @@ def table(ax,
530529
if rowLabels is not None:
531530
for row in xrange(rows):
532531
table.add_cell(row+offset, -1,
533-
width=rowLabelWidth, height=height,
532+
width=rowLabelWidth or 1e-15, height=height,
534533
text=rowLabels[row], facecolor=rowColours[row],
535534
loc=rowLoc)
536535
if rowLabelWidth == 0:

0 commit comments

Comments
 (0)