| 158 | |
| 159 | # Plot data in a "spectrogram colormap" |
| 160 | def plot_specgram(data, logname, max_freq, axis): |
| 161 | pdata, bins, t = calc_specgram(data, axis) |
| 162 | |
| 163 | fig, ax = matplotlib.pyplot.subplots() |
| 164 | ax.set_title("\n".join(wrap("Spectrogram %s (%s)" % (axis, logname), |
| 165 | MAX_TITLE_LENGTH))) |
| 166 | ax.pcolormesh(t, bins, pdata, norm=matplotlib.colors.LogNorm()) |
| 167 | ax.set_ylim([0., max_freq]) |
| 168 | ax.set_ylabel('frequency (hz)') |
| 169 | ax.set_xlabel('Time (s)') |
| 170 | fig.tight_layout() |
| 171 | return fig |
| 172 | |
| 173 | ###################################################################### |
| 174 | # CSV output |