Skip to content

Commit

Permalink
Fix issue #2 (patch courtesy of psycho23)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmick0 committed Jul 8, 2017
1 parent 5dc632d commit c9f055c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spectrogram.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import matplotlib.pyplot as plt
import matplotlib.ticker
import numpy as np
import warnings
import sys

from wavwrapper import wavfile, monowrapper
Expand Down Expand Up @@ -86,7 +87,12 @@ def main(input_file=None, window_size="1024", scale="log"):

# Use log scale above 100 Hz, linear below.
if scale == 'log':
plt.yscale('symlog', linthreshy=100, linscaley=0.25)
yscale = 0.25
# Mitigation for issue 2 (https://github.com/le1ca/spectrogram/issues/2)
if matplotlib.__version__[0:3] == '1.3':
yscale = 1
warnings.warn('You are using matplotlib 1.3.* (and not >= 1.4.0). Therefore linscaley must equal 1, not 0.25')
plt.yscale('symlog', linthreshy=100, linscaley=yscale)
ax.yaxis.set_major_formatter(matplotlib.ticker.ScalarFormatter())

# Set x/y limits by using the maximums from the time/frequency arrays.
Expand Down

0 comments on commit c9f055c

Please sign in to comment.