Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 29d8d57

Browse filesBrowse files
committed
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 svn path=/trunk/matplotlib/; revision=5138
1 parent c7ed151 commit 29d8d57
Copy full SHA for 29d8d57

File tree

Expand file treeCollapse file tree

5 files changed

+11
-9
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+11
-9
lines changed

‎examples/custom_projection_example.py

Copy file name to clipboardExpand all lines: examples/custom_projection_example.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
BboxTransformTo, IdentityTransform, Transform, TransformWrapper
88
from matplotlib.projections import register_projection
99

10+
import numpy as npy
11+
1012
# This example projection class is rather long, but it is designed to
1113
# illustrate many features, not all of which will be used every time.
1214
# It is also common to factor out a lot of these methods into common

‎examples/legend_scatter.py

Copy file name to clipboardExpand all lines: examples/legend_scatter.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
N=1000
55

6-
props = dict( alpha=0.5, faceted=False )
6+
props = dict( alpha=0.5, edgecolors='none' )
77

88
handles = []
99
colours = ['red', 'green', 'blue', 'magenta', 'cyan', 'yellow']

‎examples/poly_editor.py

Copy file name to clipboardExpand all lines: examples/poly_editor.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""
66
from matplotlib.artist import Artist
77
from matplotlib.patches import Polygon, CirclePolygon
8-
from numpy import sqrt, nonzero, equal, asarray, dot, amin
8+
from numpy import sqrt, nonzero, equal, array, asarray, dot, amin, cos, sin
99
from matplotlib.mlab import dist_point_to_segment
1010

1111

@@ -69,7 +69,7 @@ def get_ind_under_point(self, event):
6969
'get the index of the vertex under point if within epsilon tolerance'
7070

7171
# display coords
72-
xy = npy.asarray(self.poly.xy)
72+
xy = asarray(self.poly.xy)
7373
xyt = self.poly.get_transform().transform(xy)
7474
xt, yt = xyt[:, 0], xyt[:, 1]
7575
d = sqrt((xt-event.x)**2 + (yt-event.y)**2)
@@ -114,7 +114,7 @@ def key_press_callback(self, event):
114114
s1 = xys[i+1]
115115
d = dist_point_to_segment(p, s0, s1)
116116
if d<=self.epsilon:
117-
self.poly.xy = npy.array(
117+
self.poly.xy = array(
118118
list(self.poly.xy[:i]) +
119119
[(event.xdata, event.ydata)] +
120120
list(self.poly.xy[i:]))
@@ -152,8 +152,8 @@ def motion_notify_callback(self, event):
152152
theta = arange(0, 2*pi, 0.1)
153153
r = 1.5
154154

155-
xs = r*npy.cos(theta)
156-
ys = r*npy.sin(theta)
155+
xs = r*cos(theta)
156+
ys = r*sin(theta)
157157

158158
poly = Polygon(zip(xs, ys,), animated=True)
159159

‎lib/matplotlib/legend.py

Copy file name to clipboardExpand all lines: lib/matplotlib/legend.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def _get_handles(self, handles, texts):
288288
width = self.handlelen, height=HEIGHT/2,
289289
)
290290
p.set_facecolor(handle._facecolors[0])
291-
if handle._edgecolors != 'None':
291+
if handle._edgecolors != 'none' and len(handle._edgecolors):
292292
p.set_edgecolor(handle._edgecolors[0])
293293
self._set_artist_props(p)
294294
p.set_clip_box(None)

‎lib/matplotlib/text.py

Copy file name to clipboardExpand all lines: lib/matplotlib/text.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ def _get_xy(self, x, y, s):
10831083
dx, dy = self._get_xy(dx, dy, self.xycoords)
10841084

10851085
# convert the offset
1086-
dpi = self.figure.dpi.get()
1086+
dpi = self.figure.get_dpi()
10871087
x *= dpi/72.
10881088
y *= dpi/72.
10891089

@@ -1095,7 +1095,7 @@ def _get_xy(self, x, y, s):
10951095
elif s=='polar':
10961096
theta, r = x, y
10971097
x = r*np.cos(theta)
1098-
y = r*np.cosmsin(theta)
1098+
y = r*np.sin(theta)
10991099
trans = self.axes.transData
11001100
return trans.transform_point((x,y))
11011101
elif s=='figure points':

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.