From: <jd...@us...> - 2007-09-12 20:25:19
|
Revision: 3843 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3843&view=rev Author: jdh2358 Date: 2007-09-12 13:25:17 -0700 (Wed, 12 Sep 2007) Log Message: ----------- minor changes for gtk navigation Modified Paths: -------------- branches/transforms/lib/matplotlib/backends/backend_gtk.py branches/transforms/lib/matplotlib/backends/backend_gtkagg.py Modified: branches/transforms/lib/matplotlib/backends/backend_gtk.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_gtk.py 2007-09-12 19:47:56 UTC (rev 3842) +++ branches/transforms/lib/matplotlib/backends/backend_gtk.py 2007-09-12 20:25:17 UTC (rev 3843) @@ -405,8 +405,8 @@ self.toolbar = self._get_toolbar(canvas) # calculate size for window - w = int (self.canvas.figure.bbox.width()) - h = int (self.canvas.figure.bbox.height()) + w = int (self.canvas.figure.bbox.width) + h = int (self.canvas.figure.bbox.height) if self.toolbar is not None: self.toolbar.show() @@ -518,7 +518,7 @@ gc = drawable.new_gc() - height = self.canvas.figure.bbox.height() + height = self.canvas.figure.bbox.height y1 = height - y1 y0 = height - y0 @@ -639,8 +639,8 @@ toolfig.subplots_adjust(top=0.9) tool = SubplotTool(self.canvas.figure, toolfig) - w = int (toolfig.bbox.width()) - h = int (toolfig.bbox.height()) + w = int (toolfig.bbox.width) + h = int (toolfig.bbox.height) window = gtk.Window() Modified: branches/transforms/lib/matplotlib/backends/backend_gtkagg.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_gtkagg.py 2007-09-12 19:47:56 UTC (rev 3842) +++ branches/transforms/lib/matplotlib/backends/backend_gtkagg.py 2007-09-12 20:25:17 UTC (rev 3843) @@ -60,8 +60,9 @@ w,h = widget.window.get_size() if w==1 or h==1: return # empty fig + # dpival = self.figure.dpi.get() MGDTODO # compute desired figure size in inches - dpival = self.figure.dpi.get() + dpival = self.figure.dpi winch = w/dpival hinch = h/dpival self.figure.set_size_inches(winch, hinch) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-26 16:52:55
|
Revision: 4446 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4446&view=rev Author: mdboom Date: 2007-11-26 08:52:53 -0800 (Mon, 26 Nov 2007) Log Message: ----------- Fix zooming with bounding box in Gtk and Qt backends (others seem to already work). Fix text rotation in Wx (non-Agg) backend. Modified Paths: -------------- branches/transforms/lib/matplotlib/backends/backend_gtk.py branches/transforms/lib/matplotlib/backends/backend_qt.py branches/transforms/lib/matplotlib/backends/backend_qt4.py branches/transforms/lib/matplotlib/backends/backend_wx.py Modified: branches/transforms/lib/matplotlib/backends/backend_gtk.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_gtk.py 2007-11-26 16:43:19 UTC (rev 4445) +++ branches/transforms/lib/matplotlib/backends/backend_gtk.py 2007-11-26 16:52:53 UTC (rev 4446) @@ -549,7 +549,7 @@ return ax = event.inaxes - l,b,w,h = [int(val) for val in ax.bbox.get_bounds()] + l,b,w,h = [int(val) for val in ax.bbox.bounds] b = int(height)-(b+h) axrect = l,b,w,h self._imageBack = axrect, drawable.get_image(*axrect) Modified: branches/transforms/lib/matplotlib/backends/backend_qt.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_qt.py 2007-11-26 16:43:19 UTC (rev 4445) +++ branches/transforms/lib/matplotlib/backends/backend_qt.py 2007-11-26 16:52:53 UTC (rev 4446) @@ -102,7 +102,7 @@ def mousePressEvent( self, event ): x = event.pos().x() # flipy so y=0 is bottom of canvas - y = self.figure.bbox.height() - event.pos().y() + y = self.figure.bbox.height - event.pos().y() button = self.buttond[event.button()] FigureCanvasBase.button_press_event( self, x, y, button ) if DEBUG: print 'button pressed:', event.button() Modified: branches/transforms/lib/matplotlib/backends/backend_qt4.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_qt4.py 2007-11-26 16:43:19 UTC (rev 4445) +++ branches/transforms/lib/matplotlib/backends/backend_qt4.py 2007-11-26 16:52:53 UTC (rev 4446) @@ -359,7 +359,7 @@ QtGui.QApplication.setOverrideCursor( QtGui.QCursor( cursord[cursor] ) ) def draw_rubberband( self, event, x0, y0, x1, y1 ): - height = self.canvas.figure.bbox.height() + height = self.canvas.figure.bbox.height y1 = height - y1 y0 = height - y0 Modified: branches/transforms/lib/matplotlib/backends/backend_wx.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_wx.py 2007-11-26 16:43:19 UTC (rev 4445) +++ branches/transforms/lib/matplotlib/backends/backend_wx.py 2007-11-26 16:52:53 UTC (rev 4446) @@ -343,10 +343,10 @@ if angle == 0.0: gfx_ctx.DrawText(s, x, y) else: - angle = angle / 180.0 * math.pi + rads = angle / 180.0 * math.pi xo = h * math.sin(rads) yo = h * math.cos(rads) - gfx_ctx.DrawRotatedText(s, x - xo, y - yo, angle) + gfx_ctx.DrawRotatedText(s, x - xo, y - yo, rads) gc.unselect() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-10 16:26:05
|
Revision: 4691 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4691&view=rev Author: mdboom Date: 2007-12-10 08:26:00 -0800 (Mon, 10 Dec 2007) Log Message: ----------- Somehow the merge went awry last time. Fixing. Modified Paths: -------------- branches/transforms/lib/matplotlib/backends/backend_cairo.py branches/transforms/lib/matplotlib/backends/backend_pdf.py branches/transforms/lib/matplotlib/backends/backend_ps.py branches/transforms/lib/matplotlib/backends/backend_svg.py Modified: branches/transforms/lib/matplotlib/backends/backend_cairo.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_cairo.py 2007-12-10 16:23:52 UTC (rev 4690) +++ branches/transforms/lib/matplotlib/backends/backend_cairo.py 2007-12-10 16:26:00 UTC (rev 4691) @@ -118,7 +118,6 @@ ctx.stroke() -<<<<<<< .working #@staticmethod def convert_path(ctx, tpath): for points, code in tpath.iter_segments(): @@ -135,48 +134,12 @@ elif code == Path.CLOSEPOLY: ctx.close_path() convert_path = staticmethod(convert_path) -======= - def draw_path(self, gc, rgbFace, path): - ctx = gc.ctx - ctx.new_path() ->>>>>>> .merge-right.r4686 -<<<<<<< .working def draw_path(self, gc, path, transform, rgbFace=None): if len(path.vertices) > 18980: raise ValueError("The Cairo backend can not draw paths longer than 18980 points.") -======= - while 1: - code, xp, yp = path.vertex() - yp = self.height - yp - - if code == agg.path_cmd_stop: - ctx.close_path() - break - elif code == agg.path_cmd_move_to: - ctx.move_to(xp, yp) - elif code == agg.path_cmd_line_to: - ctx.line_to(xp, yp) - elif code == agg.path_cmd_curve3: - _, xp1, yp1 = path.vertex() - yp1 = self.height - yp1 - ctx.curve_to(xp, yp, xp, yp, xp1, yp1) - elif code == agg.path_cmd_curve4: - _, xp1, yp1 = path.vertex() - yp1 = self.height - yp1 - _, xp2, yp2 = path.vertex() - yp2 = self.height - yp2 - ctx.curve_to(xp, yp, xp1, yp1, xp2, yp2) - elif code == agg.path_cmd_end_poly: - ctx.close_path() - self._fill_and_stroke(ctx, rgbFace) - - def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2, - rotation): - if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name()) ->>>>>>> .merge-right.r4686 ctx = gc.ctx transform = transform + \ Affine2D().scale(1.0, -1.0).translate(0, self.height) Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-12-10 16:23:52 UTC (rev 4690) +++ branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-12-10 16:26:00 UTC (rev 4691) @@ -1211,97 +1211,7 @@ stat_key, (realpath, Set())) used_characters[1].update(set) -<<<<<<< .working def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): -======= - def draw_arc(self, gcEdge, rgbFace, x, y, width, height, - angle1, angle2, rotation): - """ - Draw an arc using GraphicsContext instance gcEdge, centered at x,y, - with width and height and angles from 0.0 to 360.0 - 0 degrees is at 3-o'clock, rotated by `rotation` degrees - positive angles are anti-clockwise - - If the color rgbFace is not None, fill the arc with it. - """ - # source: agg_bezier_arc.cpp in agg23 - - def arc_to_bezier(cx, cy, rx, ry, angle1, sweep, rotation): - halfsweep = sweep / 2.0 - x0, y0 = cos(halfsweep), sin(halfsweep) - tx = (1.0 - x0) * 4.0/3.0; - ty = y0 - tx * x0 / y0; - px = x0, x0+tx, x0+tx, x0 - py = -y0, -ty, ty, y0 - sn, cs = sin(angle1 + halfsweep), cos(angle1 + halfsweep) - result = [ (rx * (pxi * cs - pyi * sn), - ry * (pxi * sn + pyi * cs)) - for pxi, pyi in zip(px, py) ] - result = [ (cx + cos(rotation)*x - sin(rotation)*y, - cy + sin(rotation)*x + cos(rotation)*y) - for x, y in result ] - return reduce(lambda x, y: x + y, result) - - epsilon = 0.01 - angle1 *= pi/180.0 - angle2 *= pi/180.0 - rotation *= pi/180.0 - sweep = angle2 - angle1 - angle1 = angle1 % (2*pi) - sweep = min(max(-2*pi, sweep), 2*pi) - - if sweep < 0.0: - sweep, angle1, angle2 = -sweep, angle2, angle1 - bp = [ pi/2.0 * i - for i in range(4) - if pi/2.0 * i < sweep-epsilon ] - bp.append(sweep) - subarcs = [ arc_to_bezier(x, y, width/2.0, height/2.0, - bp[i], bp[i+1]-bp[i], rotation) - for i in range(len(bp)-1) ] - - self.check_gc(gcEdge, rgbFace) - self.file.output(subarcs[0][0], subarcs[0][1], Op.moveto) - for arc in subarcs: - self.file.output(*(arc[2:] + (Op.curveto,))) - - self.file.output(self.gc.close_and_paint()) - - def draw_path(self, gc, rgbFace, path): - self.check_gc(gc, rgbFace) - - cmds = [] - - while 1: - code, xp, yp = path.vertex() - - if code == agg.path_cmd_stop: - cmds.append(Op.closepath) - break - elif code == agg.path_cmd_move_to: - cmds.extend([xp, yp, Op.moveto]) - elif code == agg.path_cmd_line_to: - cmds.extend([xp, yp, Op.lineto]) - elif code == agg.path_cmd_curve3: - cmds.extend([xp, yp]) - cmds.extend([xp, yp]) - cmds.extend(path.vertex()[1:]) - cmds.append(Op.curveto) - elif code == agg.path_cmd_curve4: - cmds.extend([xp, yp]) - cmds.extend(path.vertex()[1:]) - cmds.extend(path.vertex()[1:]) - cmds.append(Op.curveto) - elif code == agg.path_cmd_end_poly: - cmds.append(Op.closepath) - self.file.output(*cmds) - self.file.output(self.gc.paint()) - - def get_image_magnification(self): - return self.image_magnification - - def draw_image(self, x, y, im, bbox): ->>>>>>> .merge-right.r4686 #print >>sys.stderr, "draw_image called" # MGDTODO: Support clippath here Modified: branches/transforms/lib/matplotlib/backends/backend_ps.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-12-10 16:23:52 UTC (rev 4690) +++ branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-12-10 16:26:00 UTC (rev 4691) @@ -1430,31 +1430,4 @@ clip newpath } bind def""", -<<<<<<< .working -======= - # angle1 angle2 rx ry x y *ellipse* - - """/ellipse { - newpath - matrix currentmatrix 7 1 roll - translate - scale - 0 0 1 5 3 roll arc - setmatrix - closepath - } bind def""", - """/unitcircle { - newpath -0. -1. moveto -0.2652031 -1.0 0.519579870785 -0.894633691588 0.707106781187 -0.707106781187 curveto -0.894633691588 -0.519579870785 1.0 -0.2652031 1.0 0.0 curveto -1.0 0.2652031 0.894633691588 0.519579870785 0.707106781187 0.707106781187 curveto -0.519579870785 0.894633691588 0.2652031 1.0 0.0 1.0 curveto --0.2652031 1.0 -0.519579870785 0.894633691588 -0.707106781187 0.707106781187 curveto --0.894633691588 0.519579870785 -1.0 0.2652031 -1.0 0.0 curveto --1.0 -0.2652031 -0.894633691588 -0.519579870785 -0.707106781187 -0.707106781187 curveto --0.519579870785 -0.894633691588 -0.2652031 -1.0 0.0 -1.0 curveto -closepath - } bind def""", - ->>>>>>> .merge-right.r4679 ] Modified: branches/transforms/lib/matplotlib/backends/backend_svg.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_svg.py 2007-12-10 16:23:52 UTC (rev 4690) +++ branches/transforms/lib/matplotlib/backends/backend_svg.py 2007-12-10 16:26:00 UTC (rev 4691) @@ -140,49 +140,6 @@ def close_group(self, s): self._svgwriter.write('</g>\n') -<<<<<<< .working -======= - def draw_path(self, gc, rgbFace, path): - cmd = [] - - while 1: - code, xp, yp = path.vertex() - yp = self.height - yp - - if code == agg.path_cmd_stop: - cmd.append('z') # Hack, path_cmd_end_poly not found - break - elif code == agg.path_cmd_move_to: - cmd.append('M%g %g' % (xp, yp)) - elif code == agg.path_cmd_line_to: - cmd.append('L%g %g' % (xp, yp)) - elif code == agg.path_cmd_curve3: - verts = [xp, yp] - verts.extent(path.vertex()[1:]) - verts[-1] = self.height - verts[-1] - cmd.append('Q%g %g %g %g' % tuple(verts)) - elif code == agg.path_cmd_curve4: - verts = [xp, yp] - verts.extend(path.vertex()[1:]) - verts[-1] = self.height - verts[-1] - verts.extend(path.vertex()[1:]) - verts[-1] = self.height - verts[-1] - cmd.append('C%g %g %g %g %g %g'%tuple(verts)) - elif code == agg.path_cmd_end_poly: - cmd.append('z') - - path_data = "".join(cmd) - self._draw_svg_element("path", 'd="%s"' % path_data, gc, rgbFace) - - def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2, rotation): - """ - Ignores angles for now - """ - details = 'cx="%s" cy="%s" rx="%s" ry="%s" transform="rotate(%1.1f %s %s)"' % \ - (x, self.height-y, width/2.0, height/2.0, -rotation, x, self.height-y) - self._draw_svg_element('ellipse', details, gc, rgbFace) - ->>>>>>> .merge-right.r4686 def option_image_nocomposite(self): """ if svg.image_noscale is True, compositing multiple images into one is prohibited This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-12 13:55:11
|
Revision: 4702 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4702&view=rev Author: mdboom Date: 2007-12-12 05:54:56 -0800 (Wed, 12 Dec 2007) Log Message: ----------- Fix a bad merge. Modified Paths: -------------- branches/transforms/lib/matplotlib/backends/backend_cairo.py branches/transforms/lib/matplotlib/backends/backend_svg.py Modified: branches/transforms/lib/matplotlib/backends/backend_cairo.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_cairo.py 2007-12-12 13:48:09 UTC (rev 4701) +++ branches/transforms/lib/matplotlib/backends/backend_cairo.py 2007-12-12 13:54:56 UTC (rev 4702) @@ -34,7 +34,6 @@ backend_version = cairo.version del _version_required -from matplotlib import agg from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\ FigureManagerBase, FigureCanvasBase from matplotlib.cbook import enumerate, izip, is_string_like Modified: branches/transforms/lib/matplotlib/backends/backend_svg.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_svg.py 2007-12-12 13:48:09 UTC (rev 4701) +++ branches/transforms/lib/matplotlib/backends/backend_svg.py 2007-12-12 13:54:56 UTC (rev 4702) @@ -2,7 +2,6 @@ import os, codecs, base64, tempfile, urllib, gzip -from matplotlib import agg from matplotlib import verbose, __version__, rcParams from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\ FigureManagerBase, FigureCanvasBase This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |