title: Frequency vs time plot python
body: <p>I have the following code:</p>
  <pre class="lang-py prettyprint-override"><code>from scipy import signal
  import numpy as np
  import matplotlib.pyplot as plt
  from scipy.io import wavfile
  
  fs, data = wavfile.read(&quot;New Recording 2.wav&quot;)
  f, t , zxx = signal.stft(data, fs)
  fa = np.array(f)
  ta = np.array(t)
  plt.plot(ta, fa, np.abs(zxx))
  plt.show()
  </code></pre>
  <p>I want to plot a graph like this: <a href="https://i.stack.imgur.com/tXLpU.png" rel="nofollow noreferrer">Graph</a>, with time (secs) on x axis and Khz on Y axis.</p>
  <p>When I run the above code I run into the value error</p>
  <blockquote>
  <p>&quot;ValueError: x and y must have same first dimension, but have shapes (3,) and (2,)&quot;</p>
  </blockquote>
  <p>I thought this was a quirk in numpy hence me converting <code>f</code> and <code>t</code> to np.arrays instead of the arrays outputted by scipy.</p>
  <p>Any help would be appreciated.</p>