# How to save a Librosa spectrogram plot as a specific sized image?

MatplotlibPythonData Visualization

To save a Librosa spectrogram plot as a specific sized image in matplotlib, we can take the following steps −

• Set the figure size and adjust the padding between and around the subplots.
• Load an audio file as a floating point time series.
• Turn off the axes.
• Compute a mel-scaled spectrogram.
• Display the spectrogram.
• To display the figure, use show() method.

## Example

from matplotlib import pyplot as plt
from librosa import display
import librosa
import numpy as np

plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True

plt.show()