Skip to content

Commit 3bf1936

Browse files
committed
Merge pull request matplotlib#1569 from NelleV/1465_remove_unworking_code_from_axes
FIX Removes code that does work from the axes module
2 parents 81086b3 + 4652560 commit 3bf1936

File tree

1 file changed

+5
-74
lines changed

1 file changed

+5
-74
lines changed

lib/matplotlib/axes.py

Lines changed: 5 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def set_default_color_cycle(clist):
155155
"""
156156
rcParams['axes.color_cycle'] = clist
157157
warnings.warn("Set rcParams['axes.color_cycle'] directly",
158-
DeprecationWarning)
158+
DeprecationWarning)
159159

160160

161161
class _process_plot_var_args(object):
@@ -271,9 +271,9 @@ def _makeline(self, x, y, kw, kwargs):
271271
# (can't use setdefault because it always evaluates
272272
# its second argument)
273273
seg = mlines.Line2D(x, y,
274-
axes=self.axes,
275-
**kw
276-
)
274+
axes=self.axes,
275+
**kw
276+
)
277277
self.set_lineprops(seg, **kwargs)
278278
return seg
279279

@@ -3196,76 +3196,7 @@ def pick(self, *args):
31963196
'see API_CHANGES in the src distribution')
31973197
martist.Artist.pick(self, args[0])
31983198

3199-
def __pick(self, x, y, trans=None, among=None):
3200-
"""
3201-
Return the artist under point that is closest to the *x*, *y*.
3202-
If *trans* is *None*, *x*, and *y* are in window coords,
3203-
(0,0 = lower left). Otherwise, *trans* is a
3204-
:class:`~matplotlib.transforms.Transform` that specifies the
3205-
coordinate system of *x*, *y*.
3206-
3207-
The selection of artists from amongst which the pick function
3208-
finds an artist can be narrowed using the optional keyword
3209-
argument *among*. If provided, this should be either a sequence
3210-
of permitted artists or a function taking an artist as its
3211-
argument and returning a true value if and only if that artist
3212-
can be selected.
3213-
3214-
Note this algorithm calculates distance to the vertices of the
3215-
polygon, so if you want to pick a patch, click on the edge!
3216-
"""
3217-
# MGDTODO: Needs updating
3218-
if trans is not None:
3219-
xywin = trans.transform_point((x, y))
3220-
else:
3221-
xywin = x, y
3222-
3223-
def dist_points(p1, p2):
3224-
'return the distance between two points'
3225-
x1, y1 = p1
3226-
x2, y2 = p2
3227-
return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
3228-
3229-
def dist_x_y(p1, x, y):
3230-
'*x* and *y* are arrays; return the distance to the closest point'
3231-
x1, y1 = p1
3232-
return min(np.sqrt((x - x1) ** 2 + (y - y1) ** 2))
3233-
3234-
def dist(a):
3235-
if isinstance(a, Text):
3236-
bbox = a.get_window_extent()
3237-
l, b, w, h = bbox.bounds
3238-
verts = (l, b), (l, b + h), (l + w, b + h), (l + w, b)
3239-
xt, yt = zip(*verts)
3240-
elif isinstance(a, Patch):
3241-
path = a.get_path()
3242-
tverts = a.get_transform().transform_path(path)
3243-
xt, yt = zip(*tverts)
3244-
elif isinstance(a, mlines.Line2D):
3245-
xdata = a.get_xdata(orig=False)
3246-
ydata = a.get_ydata(orig=False)
3247-
xt, yt = a.get_transform().numerix_x_y(xdata, ydata)
3248-
3249-
return dist_x_y(xywin, np.asarray(xt), np.asarray(yt))
3250-
3251-
artists = self.lines + self.patches + self.texts
3252-
if callable(among):
3253-
# FIXME test is not defined
3254-
artists = filter(test, artists)
3255-
elif iterable(among):
3256-
amongd = dict([(k, 1) for k in among])
3257-
artists = [a for a in artists if a in amongd]
3258-
elif among is None:
3259-
pass
3260-
else:
3261-
raise ValueError('among must be callable or iterable')
3262-
if not len(artists):
3263-
return None
3264-
ds = [(dist(a), a) for a in artists]
3265-
ds.sort()
3266-
return ds[0][1]
3267-
3268-
#### Labelling
3199+
### Labelling
32693200

32703201
def get_title(self):
32713202
"""

0 commit comments

Comments
 (0)