Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Documentation update for specgram #1489

merged 2 commits into from

3 participants


Mention that plotted data is in dB

In response to:

@gitj gitj Update documentation of specgram
Mention that plotted data is in dB

looks good to me, but when I saw that thread, I ended up adding a note by the return value, as well as a comment in the code. Can you cherrypick from ivanov/matplotlib@5b52fc3 ?

On your master branch, this should do the trick:

git remote add ivanov git://
git fetch ivanov
git cherry-pick 5b52fc30fa49

@ivanov : you might already know, but it is possible to submit a PR against @gitj 's branch.


@pelson yes, I was just trying to avoid an extra merge commit, but now submitted a PR against @gitj branch, though had some trouble with that, because my Pull Request drop down menu did not list @gitj/matplotlib in the possible base repos.

The workaround I used was to select one of the available base repos, noting the URL change, and then manually changing the URL with gitj in the appropriate place. I submitted this information to github support, so hopefully the will track it down.

@gitj, you should be able to merge my PR against your branch, which will then percolate to this PR.


ok, @gitj caught an error I made in describing the return value, so gitj/matplotlib#1 is closed now. So I'm happy with this now :)


:+1: looks good to me. Thanks @ivanov & @gitj!


it's never a bad time to have better docs, merging this one, thanks again, @gitj!

@ivanov ivanov merged commit a1f8b4e into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 12, 2012
  1. @gitj

    Update documentation of specgram

    gitj authored
    Mention that plotted data is in dB
Commits on Nov 13, 2012
  1. @gitj
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/matplotlib/
8 lib/matplotlib/
@@ -8573,11 +8573,12 @@ def specgram(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
cmap=None, xextent=None, pad_to=None, sides='default',
scale_by_freq=None, **kwargs)
- Compute a spectrogram of data in *x*. Data are split into
+ Compute and plot a spectrogram of data in *x*. Data are split into
*NFFT* length segments and the PSD of each section is
computed. The windowing function *window* is applied to each
segment, and the amount of overlap of each segment is
- specified with *noverlap*.
+ specified with *noverlap*. The spectrogram is plotted in decibels
+ as a colormap (using imshow).
@@ -8616,6 +8617,9 @@ def specgram(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
spectrum is shown. If *x* is complex, both positive and
negative parts of the spectrum are shown. This can be
overridden using the *sides* keyword argument.
+ Also note that while the plot is in dB, the *Pxx* array returned is
+ linear in power.
Something went wrong with that request. Please try again.