Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove deprecated mlab code #12165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 66 commits into from
Oct 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
31dff4f
Remove mlab.logspace
dstansby Sep 19, 2018
66f075e
Remove mlab.cohere_pairs
dstansby Sep 19, 2018
d6b54ab
Remove mlab.entropy
dstansby Sep 19, 2018
02c939f
Remove mlab.normpdf
dstansby Sep 19, 2018
0bf2b34
Remove mlab.find
dstansby Sep 19, 2018
3ad4dda
Remove mlab.longest_contiguous_ones
dstansby Sep 19, 2018
b17ecca
Remove mlab.PCA
dstansby Sep 19, 2018
61467cf
Remove mlab.prctile and mlab.prctile_rank
dstansby Sep 19, 2018
4cb0ab6
Remove mlab.center_matrix
dstansby Sep 19, 2018
d3e2636
Remove mlab.rk4
dstansby Sep 19, 2018
5966998
Remove mlab.bivariate_normal
dstansby Sep 19, 2018
ee38004
Remove mlab.get_xyz_where
dstansby Sep 19, 2018
2792962
Remove mlab.get_sparse_matrix
dstansby Sep 19, 2018
563bc0d
Remove mlab.dist, mlab.dist_point_to_segment
dstansby Sep 19, 2018
3d93777
Remove mlab.griddata
dstansby Sep 19, 2018
7ede68c
Remove mlab.less_simple_linear_interpolation
dstansby Sep 19, 2018
fb07c42
Remove mlab.slopes, mlab.stineman_interp
dstansby Sep 19, 2018
a0b619f
Remove mlab.segments_intersect
dstansby Sep 19, 2018
feeb8f7
Remove mlab.fftsurr
dstansby Sep 19, 2018
5efed6c
Remove mlab.offset_line
dstansby Sep 20, 2018
327a732
Remove mlab.quad2cubic
dstansby Sep 20, 2018
8a7c90b
Remove mlab.path_length
dstansby Sep 20, 2018
c00adaf
Remove mlab.distances_along_curve
dstansby Sep 20, 2018
b2566e5
Remove mlab.vector_lengths
dstansby Sep 20, 2018
e89fe8e
Remove mlab.cross_from_above and mlab.cross_from_below
dstansby Sep 20, 2018
6ae6058
Remove mlab.contiguous_regions
dstansby Sep 20, 2018
d0bda5e
Remove mlab.is_closed_polygon
dstansby Sep 20, 2018
f4b13e9
Remove mlab.poly_between
dstansby Sep 20, 2018
2c861a3
Remove mlab.poly_below
dstansby Sep 20, 2018
3d8bce1
Remove mlab.inside_poly
dstansby Sep 20, 2018
f882efd
Remove mlab.rec2csv
dstansby Sep 21, 2018
f1c3ee3
Remove mlab.rec2txt
dstansby Sep 21, 2018
e6345ea
Remove mlab.csvformat_factory
dstansby Sep 21, 2018
52b55de
Remove mlab.get_formatd
dstansby Sep 21, 2018
197228d
Remove mlab.FormatDatetime
dstansby Sep 21, 2018
ff137b6
Remove mlab.FormatDate
dstansby Sep 21, 2018
b542961
Remove mlab.Format... classes
dstansby Sep 21, 2018
6de5073
Remove mlab.recs_join
dstansby Sep 21, 2018
be0ddca
Remove mlab.rec_join
dstansby Sep 21, 2018
5b11761
Remove mlab.rec_summarize
dstansby Sep 21, 2018
7474746
Remove mlab.rec_groupby
dstansby Sep 21, 2018
7c7d859
Remove mlab.rec_keep_fields
dstansby Sep 21, 2018
afcb2b6
Remove mlab.rec_drop_fields
dstansby Sep 21, 2018
ac0fc08
Remove mlab.rec_append_fields
dstansby Sep 21, 2018
9aaf9fc
Remove mlab.exp_safe
dstansby Sep 22, 2018
7d31ed2
Remove mlab.amap
dstansby Sep 22, 2018
2821f1b
Remove mlab.rms_flat
dstansby Sep 22, 2018
8f9b0c6
Remove mlab.l1norm
dstansby Sep 22, 2018
c26f1d6
Remove mlab.l2norm
dstansby Sep 22, 2018
2d15f21
Remove mlab.norm_flat
dstansby Sep 22, 2018
00cace4
Remove mlab.frange
dstansby Sep 22, 2018
9b81fd2
Remove mlab.identity
dstansby Sep 22, 2018
22fe034
Remove mlab.base_repr
dstansby Sep 22, 2018
f336729
Remove mlab.log2
dstansby Sep 22, 2018
76864f0
Remove mlab.binary_repr
dstansby Sep 22, 2018
a934ad8
Remove mlab.ispower2
dstansby Sep 22, 2018
dedc269
Remove mlab.isvector
dstansby Sep 22, 2018
2157968
Remove mlab.movavg
dstansby Sep 22, 2018
8e7eea0
Remove mlab.safe_isinf, mlab.safe_isnan
dstansby Sep 22, 2018
872e93e
Clean up code listing
dstansby Sep 24, 2018
5ea3cf3
Clean up the top of mlab
dstansby Sep 24, 2018
2ca407f
Make mlab.csv2rec private
dstansby Sep 24, 2018
ddf38fe
Add pylab api changes
dstansby Sep 29, 2018
0466b93
Move methods to functions in poly_editor.py
dstansby Oct 2, 2018
89cf598
Copy in kwarg definitions to pyplot.plotfile
dstansby Oct 3, 2018
ca54244
Add missing alternatives
dstansby Oct 3, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions doc/api/next_api_changes/2018-09-18-DS-mlab.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
Removal of deprecated :mod:`matplotlib.mlab` code
-------------------------------------------------

Lots of code inside the :mod:`matplotlib.mlab` module which was deprecated
in Matplotlib 2.2 has been removed. See below for a list:

- ``mlab.exp_safe`` (use `numpy.exp` instead)
- ``mlab.amap``
- ``mlab.logspace`` (use `numpy.logspace` instead)
- ``mlab.rms_flat``
- ``mlab.l1norm`` (use ``numpy.linalg.norm(a, ord=1)`` instead)
- ``mlab.l2norm`` (use ``numpy.linalg.norm(a, ord=2)`` instead)
- ``mlab.norm_flat`` (use ``numpy.linalg.norm(a.flat, ord=2)`` instead)
- ``mlab.frange`` (use `numpy.arange` instead)
- ``mlab.identity`` (use `numpy.identity` instead)
- ``mlab.base_repr``
- ``mlab.binary_repr``
- ``mlab.ispower2``
- ``mlab.log2`` (use `numpy.log2` instead)
- ``mlab.isvector``
- ``mlab.movavg``
- ``mlab.safe_isinf`` (use `numpy.isinf` instead)
- ``mlab.safe_isnan`` (use `numpy.isnan` instead)
- ``mlab.cohere_pairs`` (use `scipy.signal.coherence` instead)
- ``mlab.entropy`` (use `scipy.stats.entropy` instead)
- ``mlab.normpdf`` (use `scipy.stats.norm.pdf` instead)
- ``mlab.find`` (use ``np.nonzero(np.ravel(condition))`` instead)
- ``mlab.longest_contiguous_ones``
- ``mlab.longest_ones``
- ``mlab.PCA``
- ``mlab.prctile`` (use `numpy.percentile` instead)
- ``mlab.prctile_rank``
- ``mlab.center_matrix``
- ``mlab.rk4`` (use `scipy.integrate.ode` instead)
- ``mlab.bivariate_normal``
- ``mlab.get_xyz_where``
- ``mlab.get_sparse_matrix``
- ``mlab.dist`` (use `numpy.hypot` instead)
- ``mlab.dist_point_to_segment``
- ``mlab.griddata`` (use `scipy.interpolate.griddata`)
- ``mlab.less_simple_linear_interpolation`` (use `numpy.interp`)
- ``mlab.slopes``
- ``mlab.stineman_interp``
- ``mlab.segments_intersect``
- ``mlab.fftsurr``
- ``mlab.offset_line``
- ``mlab.quad2cubic``
- ``mlab.vector_lengths``
- ``mlab.distances_along_curve``
- ``mlab.path_length``
- ``mlab.cross_from_above``
- ``mlab.cross_from_below``
- ``mlab.contiguous_regions`` (use `.cbook.contiguous_regions` instead)
- ``mlab.is_closed_polygon``
- ``mlab.poly_between``
- ``mlab.poly_below``
- ``mlab.inside_poly``
- ``mlab.csv2rec``
- ``mlab.rec2csv`` (use `numpy.recarray.tofile` instead)
- ``mlab.rec2text`` (use `numpy.recarray.tofile` instead)
- ``mlab.rec_summarize``
- ``mlab.rec_join``
- ``mlab.recs_join``
- ``mlab.rec_groupby``
- ``mlab.rec_keep_fields``
- ``mlab.rec_drop_fields``
- ``mlab.rec_append_fields``
- ``mlab.csvformat_factory``
- ``mlab.get_formatd``
- ``mlab.FormatDatetime`` (use `datetime.datetime.strftime` instead)
- ``mlab.FormatDate`` (use `datetime.date.strftime` instead)
- ``mlab.FormatMillions``, ``mlab.FormatThousands``, ``mlab.FormatPercent``,
``mlab.FormatBool``, ``mlab.FormatInt``, ``mlab.FormatFloat``,
``mlab.FormatFormatStr``, ``mlab.FormatString``, ``mlab.FormatObj``
- ``mlab.donothing_callback``
52 changes: 52 additions & 0 deletions doc/api/next_api_changes/2018-09-18-DS-pylab.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Removal of deprecated :mod:`matplotlib.pylab` code
--------------------------------------------------

Lots of code inside the :mod:`matplotlib.mlab` module which was deprecated
in Matplotlib 2.2 has been removed. This means the following functions are
no longer available in the `matplotlib.pylab` module:

- ``amap``
- ``base_repr``
- ``binary_repr``
- ``bivariate_normal``
- ``center_matrix``
- ``csv2rec`` (use `numpy.recarray.tofile` instead)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does csv2rec have a replacement? tofile seems like a replacement for rec2csv not csv2rec.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest using pandas instead. If you really need csv -> record array the best course of action is probably to vendor the code to your project.

- ``dist`` (use `numpy.hypot` instead)
- ``dist_point_to_segment``
- ``distances_along_curve``
- ``entropy`` (use `scipy.stats.entropy` instead)
- ``exp_safe`` (use `numpy.exp` instead)
- ``fftsurr``
- ``find`` (use ``np.nonzero(np.ravel(condition))`` instead)
- ``frange`` (use `numpy.arange` instead)
- ``get_sparse_matrix``
- ``get_xyz_where``
- ``griddata`` (use `scipy.interpolate.griddata` instead)
- ``identity`` (use `numpy.identity` instead)
- ``inside_poly``
- ``is_closed_polygon``
- ``ispower2``
- ``isvector``
- ``l1norm`` (use ``numpy.linalg.norm(a, ord=1)`` instead)
- ``l2norm`` (use ``numpy.linalg.norm(a, ord=2)`` instead)
- ``log2`` (use `numpy.log2` instead)
- ``longest_contiguous_ones``
- ``longest_ones``
- ``movavg``
- ``norm_flat`` (use ``numpy.linalg.norm(a.flat, ord=2)`` instead)
- ``normpdf`` (use `scipy.stats.norm.pdf` instead)
- ``path_length``
- ``poly_below``
- ``poly_between``
- ``prctile`` (use `numpy.percentile` instead)
- ``prctile_rank``
- ``rec2csv`` (use `numpy.recarray.tofile` instead)
- ``rec_append_fields``
- ``rec_drop_fields``
- ``rec_join``
- ``rk4`` (use `scipy.integrate.ode` instead)
- ``rms_flat``
- ``segments_intersect``
- ``slopes``
- ``stineman_interp``
- ``vector_lengths``
29 changes: 28 additions & 1 deletion examples/event_handling/poly_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,34 @@
import numpy as np
from matplotlib.lines import Line2D
from matplotlib.artist import Artist
from matplotlib.mlab import dist_point_to_segment


def dist(x, y):
"""
Return the distance between two points.
"""
d = x - y
return np.sqrt(np.dot(d, d))


def dist_point_to_segment(p, s0, s1):
"""
Get the distance of a point to a segment.
*p*, *s0*, *s1* are *xy* sequences
This algorithm from
http://geomalgorithms.com/a02-_lines.html
"""
v = s1 - s0
w = p - s0
c1 = np.dot(w, v)
if c1 <= 0:
return dist(p, s0)
c2 = np.dot(v, v)
if c2 <= c1:
return dist(p, s1)
b = c1 / c2
pb = s0 + b * v
return dist(p, pb)


class PolygonInteractor(object):
Expand Down
Loading