From: <md...@us...> - 2008-05-14 16:40:44
|
Revision: 5138 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5138&view=rev Author: mdboom Date: 2008-05-14 09:39:28 -0700 (Wed, 14 May 2008) Log Message: ----------- Fix various bugs submitted by Matthias Michler: - Parts of text.py were not updated for the new transforms - Import/namespace errors in custom_projection_example.py, poly_editor.py - Fix legend_scatter.py Modified Paths: -------------- trunk/matplotlib/examples/custom_projection_example.py trunk/matplotlib/examples/legend_scatter.py trunk/matplotlib/examples/poly_editor.py trunk/matplotlib/lib/matplotlib/legend.py trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/examples/custom_projection_example.py =================================================================== --- trunk/matplotlib/examples/custom_projection_example.py 2008-05-14 13:52:22 UTC (rev 5137) +++ trunk/matplotlib/examples/custom_projection_example.py 2008-05-14 16:39:28 UTC (rev 5138) @@ -7,6 +7,8 @@ BboxTransformTo, IdentityTransform, Transform, TransformWrapper from matplotlib.projections import register_projection +import numpy as npy + # This example projection class is rather long, but it is designed to # illustrate many features, not all of which will be used every time. # It is also common to factor out a lot of these methods into common Modified: trunk/matplotlib/examples/legend_scatter.py =================================================================== --- trunk/matplotlib/examples/legend_scatter.py 2008-05-14 13:52:22 UTC (rev 5137) +++ trunk/matplotlib/examples/legend_scatter.py 2008-05-14 16:39:28 UTC (rev 5138) @@ -3,7 +3,7 @@ N=1000 -props = dict( alpha=0.5, faceted=False ) +props = dict( alpha=0.5, edgecolors='none' ) handles = [] colours = ['red', 'green', 'blue', 'magenta', 'cyan', 'yellow'] Modified: trunk/matplotlib/examples/poly_editor.py =================================================================== --- trunk/matplotlib/examples/poly_editor.py 2008-05-14 13:52:22 UTC (rev 5137) +++ trunk/matplotlib/examples/poly_editor.py 2008-05-14 16:39:28 UTC (rev 5138) @@ -5,7 +5,7 @@ """ from matplotlib.artist import Artist from matplotlib.patches import Polygon, CirclePolygon -from numpy import sqrt, nonzero, equal, asarray, dot, amin +from numpy import sqrt, nonzero, equal, array, asarray, dot, amin, cos, sin from matplotlib.mlab import dist_point_to_segment @@ -69,7 +69,7 @@ 'get the index of the vertex under point if within epsilon tolerance' # display coords - xy = npy.asarray(self.poly.xy) + xy = asarray(self.poly.xy) xyt = self.poly.get_transform().transform(xy) xt, yt = xyt[:, 0], xyt[:, 1] d = sqrt((xt-event.x)**2 + (yt-event.y)**2) @@ -114,7 +114,7 @@ s1 = xys[i+1] d = dist_point_to_segment(p, s0, s1) if d<=self.epsilon: - self.poly.xy = npy.array( + self.poly.xy = array( list(self.poly.xy[:i]) + [(event.xdata, event.ydata)] + list(self.poly.xy[i:])) @@ -152,8 +152,8 @@ theta = arange(0, 2*pi, 0.1) r = 1.5 -xs = r*npy.cos(theta) -ys = r*npy.sin(theta) +xs = r*cos(theta) +ys = r*sin(theta) poly = Polygon(zip(xs, ys,), animated=True) Modified: trunk/matplotlib/lib/matplotlib/legend.py =================================================================== --- trunk/matplotlib/lib/matplotlib/legend.py 2008-05-14 13:52:22 UTC (rev 5137) +++ trunk/matplotlib/lib/matplotlib/legend.py 2008-05-14 16:39:28 UTC (rev 5138) @@ -288,7 +288,7 @@ width = self.handlelen, height=HEIGHT/2, ) p.set_facecolor(handle._facecolors[0]) - if handle._edgecolors != 'None': + if handle._edgecolors != 'none' and len(handle._edgecolors): p.set_edgecolor(handle._edgecolors[0]) self._set_artist_props(p) p.set_clip_box(None) Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2008-05-14 13:52:22 UTC (rev 5137) +++ trunk/matplotlib/lib/matplotlib/text.py 2008-05-14 16:39:28 UTC (rev 5138) @@ -1083,7 +1083,7 @@ dx, dy = self._get_xy(dx, dy, self.xycoords) # convert the offset - dpi = self.figure.dpi.get() + dpi = self.figure.get_dpi() x *= dpi/72. y *= dpi/72. @@ -1095,7 +1095,7 @@ elif s=='polar': theta, r = x, y x = r*np.cos(theta) - y = r*np.cosmsin(theta) + y = r*np.sin(theta) trans = self.axes.transData return trans.transform_point((x,y)) elif s=='figure points': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |