Clean warnings in examples #6239

Merged
merged 7 commits into from Apr 1, 2016

Conversation

Projects
None yet
4 participants
Owner

jenshnielsen commented Mar 29, 2016

These are mostly numpy warnings

  • Make sure indices are integers
  • The numpy check for positive-semidefinite has changes, so change the data in power_norm_demo.py to not see the warning
  • Dont forward trim from axisartist to ticker where it has no effect.

jenshnielsen added some commits Mar 29, 2016

@jenshnielsen jenshnielsen Make sure cov matrix is positive-semidefinite
Fixes a numpy warning. The old matrix was positive-semidefinite according to the old check in numpy but it seems this has changed a bit
88d90f2
@jenshnielsen jenshnielsen Image slice example: make sure ind is an integer bae3a10
@jenshnielsen jenshnielsen Centered ticklabels: make sure index is an int d0f5abf
@jenshnielsen jenshnielsen Stock_demo data_helper ensure indices are ints before using numpy aaa3216
@jenshnielsen jenshnielsen Quiver_demo cast indices to int before indexing numpy array 4b6112e
@jenshnielsen jenshnielsen Dont forward trim argument to ticker where it has no effect
58a27bf

mdboom added the needs_review label Mar 29, 2016

@QuLogic QuLogic and 1 other commented on an outdated diff Mar 29, 2016

examples/pylab_examples/centered_ticklabels.py
@@ -45,6 +45,6 @@
tick.tick2line.set_markersize(0)
tick.label1.set_horizontalalignment('center')
-imid = len(r)/2
+imid = int(len(r)/2)
@QuLogic

QuLogic Mar 29, 2016

Member

How about just len(r) // 2 (and the same in many other cases)?

@jenshnielsen

jenshnielsen Mar 30, 2016

Owner

Sure, I dont have any strong preference for one over the other

@jenshnielsen jenshnielsen Use floordiv as sugested by QuLogic
d82de88

@QuLogic QuLogic commented on the diff Mar 30, 2016

examples/pylab_examples/quiver_demo.py
@@ -75,8 +75,13 @@
# 6
plt.figure()
M = np.zeros(U.shape, dtype='bool')
-M[U.shape[0]/3:2*U.shape[0]/3,
- U.shape[1]/3:2*U.shape[1]/3] = True
+XMaskStart = U.shape[0]//3
@QuLogic

QuLogic Mar 30, 2016

Member

This name is a bit un-Pythonic, but otherwise the PR is fine.

@tacaswell tacaswell merged commit 0423430 into matplotlib:master Apr 1, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

tacaswell removed the needs_review label Apr 1, 2016

Owner

tacaswell commented Apr 1, 2016

how far back do we want to backport this?

Owner

jenshnielsen commented Apr 1, 2016

I probably made a bit of a mess of this 58a27bf does not make sense to backport further than 2.0 (since it relates to a arg deprecated in 2.0)

Thes rest could be back ported to 1.5.x, The numpy related changes are probably the most serious ones. They will brake code with some future version of numpy.

Owner

tacaswell commented Apr 1, 2016

Lets just do back to 2.0 then.

@tacaswell tacaswell added a commit that referenced this pull request Apr 1, 2016

@tacaswell tacaswell Merge pull request #6239 from jenshnielsen/cleanexampleswarnings
Clean warnings in examples
c455e52
Owner

tacaswell commented Apr 1, 2016

backported to v2.x as c455e52

jenshnielsen deleted the jenshnielsen:cleanexampleswarnings branch Apr 2, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment