Skip to content

Replace mlab functions - #9177

Closed
dstansby wants to merge 3 commits into
matplotlib:masterfrom
dstansby:replace-path-length
Closed

dstansby wants to merge 3 commits into
matplotlib:masterfrom
dstansby:replace-path-length

Conversation

@dstansby

Copy link
Copy Markdown
Member

Allows a few functions in mlab.py to be deprecated.

@dstansby dstansby added this to the 2.2 (next next feature release) milestone Sep 10, 2017
Comment thread lib/matplotlib/contour.py Outdated
# Alternative to np.linalg.norm()
# as numpy 1.7 doesn't have 'axis' kwarg
dX = np.sum(dX**2, axis=1)**(1 / 2)
return np.concatenate((np.zeros(1), np.cumsum(dX)))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I suspect this can be done more efficiently with 3 lines in place of the function:

pl = np.zeros(slc.shape[0], dtype=float)
dx = np.diff(slc, axis=0)
pl[1:] = np.cumsum(np.hypot(dx[:, 0], dx[:, 1]))

@anntzer

anntzer commented Sep 12, 2017

Copy link
Copy Markdown
Contributor

Would it be simpler to bump the numpy version to 1.8.0? Relevant ubuntu versions right now are at https://www.ubuntu.com/info/release-end-of-life:
12.04 LTS "ubuntu advantage customers" has numpy 1.6.1 so they're already out anyways.
14.04 LTS has numpy 1.8.1.
https://pkgs.org/download/python3-numpy

Plus this way we get np.full :-)

@dstansby dstansby mentioned this pull request Sep 21, 2017
7 of 28 tasks
@dstansby dstansby changed the title Replace mlab functions in contour labelling Replace mlab functions Sep 21, 2017
@dstansby

Copy link
Copy Markdown
Member Author

I'm going to move everything over to #9151 for simplicity (sorry if people are getting lots of notifications...)

@dstansby dstansby closed this Sep 21, 2017
@dstansby
dstansby deleted the replace-path-length branch September 24, 2017 19:06
@QuLogic QuLogic modified the milestones: needs sorting, v2.2.0 Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants