From: <md...@us...> - 2007-10-15 14:03:49
|
Revision: 3948 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3948&view=rev Author: mdboom Date: 2007-10-15 07:03:19 -0700 (Mon, 15 Oct 2007) Log Message: ----------- Merged revisions 3933-3947 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib ........ r3935 | mdboom | 2007-10-11 13:03:50 -0400 (Thu, 11 Oct 2007) | 1 line Fixed minor import bug ........ r3941 | jdh2358 | 2007-10-14 15:00:50 -0400 (Sun, 14 Oct 2007) | 1 line added ellipse compare script ........ Modified Paths: -------------- branches/transforms/lib/matplotlib/backends/backend_agg.py branches/transforms/lib/matplotlib/backends/backend_ps.py Added Paths: ----------- branches/transforms/unit/ellipse_compare.py Modified: branches/transforms/lib/matplotlib/backends/backend_agg.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-10-15 13:49:25 UTC (rev 3947) +++ branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-10-15 14:03:19 UTC (rev 3948) @@ -109,8 +109,9 @@ debug=False) if __debug__: verbose.report('RendererAgg.__init__ _RendererAgg done', 'debug-annoying') - #self.draw_path = self._renderer.draw_path - #self.draw_markers = self._renderer.draw_markers + self.draw_path = self._renderer.draw_path + self.draw_markers = self._renderer.draw_markers + self.draw_path_collection = self._renderer.draw_path_collection self.draw_image = self._renderer.draw_image self.copy_from_bbox = self._renderer.copy_from_bbox self.restore_region = self._renderer.restore_region @@ -121,26 +122,6 @@ if __debug__: verbose.report('RendererAgg.__init__ done', 'debug-annoying') - def draw_path(self, gc, path, trans, rgbFace=None): - assert trans.is_affine - self._renderer.draw_path(gc, path, trans.frozen(), rgbFace) - - def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None): - assert marker_trans.is_affine - assert trans.is_affine - self._renderer.draw_markers(gc, marker_path, marker_trans.frozen(), path, trans.frozen(), rgbFace) - - def draw_path_collection(self, master_transform, clipbox, clippath, clippath_trans, - paths, transforms, offsets, transOffset, facecolors, edgecolors, - linewidths, linestyles, antialiaseds): - assert master_transform.is_affine - if transOffset is not None: - transOffset = transOffset.frozen() - self._renderer.draw_path_collection( - master_transform.frozen(), clipbox, clippath, clippath_trans, - paths, transforms, offsets, transOffset, facecolors, edgecolors, linewidths, - linestyles, antialiaseds) - def draw_mathtext(self, gc, x, y, s, prop, angle): """ Draw the math text using matplotlib.mathtext @@ -153,11 +134,6 @@ x = int(x) + ox y = int(y) - oy self._renderer.draw_text_image(font_image, x, y + 1, angle, gc) - if 0: - self._renderer.draw_rectangle(gc, None, - int(x), - self.height-int(y), - width, height) def draw_text(self, gc, x, y, s, prop, angle, ismath): """ @@ -173,13 +149,13 @@ if len(s) == 1 and ord(s) > 127: font.load_char(ord(s), flags=LOAD_DEFAULT) else: + # We pass '0' for angle here, since it will be rotated (in raster + # space) in the following call to draw_text_image). font.set_text(s, 0, flags=LOAD_DEFAULT) font.draw_glyphs_to_bitmap() #print x, y, int(x), int(y) - # We pass '0' for angle here, since is has already been rotated - # (in vector space) in the above call to font.set_text. self._renderer.draw_text_image(font.get_image(), int(x), int(y) + 1, angle, gc) def get_text_width_height_descent(self, s, prop, ismath, rgb=(0,0,0)): Modified: branches/transforms/lib/matplotlib/backends/backend_ps.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-10-15 13:49:25 UTC (rev 3947) +++ branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-10-15 14:03:19 UTC (rev 3948) @@ -882,7 +882,7 @@ """ # local variable eliminates all repeated attribute lookups write = self._pswriter.write - + write('gsave\n') if debugPS and command: write("% "+command+"\n") @@ -915,7 +915,7 @@ write("stroke\n") if cliprect: write("grestore\n") - + write('grestore\n') def push_gc(self, gc, store=1): """ Push the current onto stack, with the exception of the clip box, which Copied: branches/transforms/unit/ellipse_compare.py (from rev 3941, trunk/matplotlib/unit/ellipse_compare.py) =================================================================== --- branches/transforms/unit/ellipse_compare.py (rev 0) +++ branches/transforms/unit/ellipse_compare.py 2007-10-15 14:03:19 UTC (rev 3948) @@ -0,0 +1,53 @@ +""" +Compare the ellipse generated with arcs versus a polygonal approximation +""" +import numpy as npy +from matplotlib import patches +from pylab import figure, show + +xcenter, ycenter = 0.38, 0.52 +#xcenter, ycenter = 0., 0. +width, height = 1e-1, 3e-1 +angle = -30 + +theta = npy.arange(0.0, 360.0, 1.0)*npy.pi/180.0 +x = width/2. * npy.cos(theta) +y = height/2. * npy.sin(theta) + +rtheta = angle*npy.pi/180. +R = npy.array([ + [npy.cos(rtheta), -npy.sin(rtheta)], + [npy.sin(rtheta), npy.cos(rtheta)], + ]) + + +x, y = npy.dot(R, npy.array([x, y])) +x += xcenter +y += ycenter + +fig = figure() +ax = fig.add_subplot(211, aspect='auto') +ax.fill(x, y, alpha=0.2, facecolor='yellow') + +e1 = patches.Ellipse((xcenter, ycenter), width, height, + angle=angle, linewidth=2, fill=False) + +ax.add_artist(e1) + +ax = fig.add_subplot(212, aspect='equal') +ax.fill(x, y, alpha=0.2, facecolor='yellow') +e2 = patches.Ellipse((xcenter, ycenter), width, height, + angle=angle, linewidth=2, fill=False) + + +ax.add_artist(e2) +ax.autoscale_view() + + +ax.set_xlim(0.2, .5) +ax.set_ylim(0.3, 0.7) + +#fig.savefig('ellipse_compare.png') +#fig.savefig('ellipse_compare.ps') + +show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |