title: scipy.signal.spectrogram output not as expected
body: <p>I am using <code>scipy.signal.spectrogram()</code> for analysing a dataset containing values for a current. My input to the function is as follows:</p>
  
  <pre><code>f, t, Sxx = signal.spectrogram(y, fs)
  </code></pre>
  
  <p>(for plotting in subplot 3 (from the top) I use <code>plt.pcolormesh(t, f, Sxx)</code>)</p>
  
  <p>Where <code>y</code> is a list of 10002 values, containing the y values for the green graph in the first plot (from the top). <code>fs = 1/T</code> where <code>T = x[1]-x[0]</code> where <code>x</code> is the list of x values (time) belonging to the y-values (current).</p>
  
  <p>My problem is that</p>
  
  <pre><code>t[-1]-t[0] != x[-1]-x[0]
  </code></pre>
  
  <p>Meaning: I want to compare plot 3 with the green graph in plot 1, and when these two do not range over the same time-span, the spectrogram becomes useless. You can see from the picture that <code>total_length_x &gt; total_length_t</code></p>
  
  <p><a href="https://i.stack.imgur.com/HCI6k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HCI6k.png" alt="enter image description here"></a></p>
  
  <p>Why is this so? And what can I do to make the spectrum range over the same time-span as my original data?</p>