Skip to content
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

update wp_scalogram demo work with matplotlib 2.0 #276

Merged
merged 1 commit into from
Jan 27, 2017

Conversation

grlee77
Copy link
Contributor

@grlee77 grlee77 commented Jan 19, 2017

After upgrading to matplotlib 2.0, I get the following error in the wp_scalogram.py demo:

Traceback (most recent call last):
  File "wp_scalogram.py", line 43, in <module>
    ax2.specgram(data, NFFT=64, noverlap=32, cmap=cmap)
  File "/Users/lee8rx/anaconda/lib/python3.5/site-packages/matplotlib/__init__.py", line 1892, in inner
    return func(ax, *args, **kwargs)
  File "/Users/lee8rx/anaconda/lib/python3.5/site-packages/matplotlib/axes/_axes.py", line 7232, in specgram
    pad_xextent = (NFFT-noverlap) / Fs / 2
TypeError: unsupported operand type(s) for /: 'int' and 'NoneType'

If I specify Fs = 2, I get the same result as previously (e.g. y axis range from [0, 1.0]). I have no experience with the specgram function, so I am not certain if this is the best solution, but it seems to work.

here is the image from matplotlib 1.5.3:
mpl_1 5 3

and here is matplotlib 2.0:
mpl_2 0 0

note that the default interpolation changed to nearest and the new viridis default colormap is used

@grlee77 grlee77 added the bug label Jan 19, 2017
@grlee77 grlee77 added this to the v1.0 milestone Jan 19, 2017
@grlee77
Copy link
Contributor Author

grlee77 commented Jan 19, 2017

looks like OS X on Travis CI took < 30 mins to start for this PR, so better than the 2 hours observed on the prior one (perhaps related to different load at differing times of day?)

@rgommers
Copy link
Member

Wouldn't it be better to change the spectrogram plot back to linear interpolation. Don't have an installed version at hand to check, and reading the MPL source code is not too helpful with **kwargs everywhere, but does adding interpolation='linear' give back the more smooth plot?

@grlee77
Copy link
Contributor Author

grlee77 commented Jan 24, 2017

yeah, that works. I have changed it to interpolation='bilinear' to get a smooth plot again.

@rgommers rgommers merged commit 816b757 into PyWavelets:master Jan 27, 2017
@rgommers
Copy link
Member

LGTM now, merged. Thanks @grlee77

@grlee77 grlee77 mentioned this pull request Mar 2, 2017
@grlee77 grlee77 deleted the mpl2_fix branch March 9, 2017 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants