# Assign variable to librosa.display.specshow() as example below:
p =librosa.display.specshow(librosa.amplitude_to_db(Y,ref=np.max), y_axis='linear', x_axis='time', sr=fs, hop_length=H, cmap=cmap)
p.xaxis.zoom(3) #the zoom-in with +number or out with -number on x-axis
# similarly the y-axis can be zoomed-in as:
p.yaxis.zoom(3)