def plot_time_freq(self, colors=True, ax=None):
import pylab as pl
if ax is None:
fig, allax = pl.subplots(1)
ax = allax
# make time matrix same shape as others
t = np.outer(self.t, np.ones(self.npeaks))
f = self.f
if colors:
mag = 20*np.log10(self.mag)
ax.scatter(t, f, s=6, c=mag, lw=0)
else:
mag = 100 + 20*np.log10(self.mag)
ax.scatter(t, f, s=mag, lw=0)
pl.xlabel('Time (s)')
pl.ylabel('Frequency (Hz)')
# if colors:
# cs = pl.colorbar(ax=ax)
# cs.set_label('Magnitude (dB)')
# pl.show()
return ax
评论列表
文章目录