0

I am plotting specgram usign the following code:

fig = plt.figure(figsize=(5.15, 5.15))
fig.clf()
plot = plt.subplot(111)
plt.specgram(data, NFFT = 256, Fs = 120000)
plot.grid(False, which="major")
plot.set_xlabel(r'\textit{Time (s)}', labelpad=6)
plot.set_ylabel(r'\textit{{Frequency (Hz)}}', labelpad=6)
plt.colorbar()
fig.savefig('specgram.pdf', bbox_inches='tight')
plt.close()

But the specgram does not fill the entire figure area as shown below:

enter image description here

What could I be possibly doing wrong?

Tom Kurushingal
  • 6,086
  • 20
  • 54
  • 86

1 Answers1

0

I think you need to set_xlim to the maximum value of your data.

Marcin
  • 215,873
  • 14
  • 235
  • 294