1

I want to save 3 mel-spectograms to one png file. I used the subplots function for this.

fig, ax = plt.subplots(nrows=3, ncols=1)
img1 = librosa.display.specshow(S_dB1, sr=sr, fmax=10000, ax=ax[0])
img2 = librosa.display.specshow(S_dB2, sr=sr, fmax=10000, ax=ax[1])
img3 = librosa.display.specshow(S_dB3, sr=sr, fmax=10000, ax=ax[2])
fig.savefig('img.png')

This is what the generated mel-spectrograms look like.

enter image description here

Any option to change the height of these mel-spectograms to make them easier to read?

Gandalf69
  • 65
  • 8

1 Answers1

2

To control the aspect ratio of the figure, use fig size. It is (width,height) in inches.

fig, ax = plt.subplots(nrows=3, ncols=1, figsize=(16,16))
Jon Nordby
  • 5,494
  • 1
  • 21
  • 50