'How can I determine the values shown on a spectrograph colorbar?

I am trying to make sure that a bunch of different spectrographs I am trying to produce have the same colorbar scale so I can compare them. This is the code I have so far:

for tr in traces:
    #fig = tr.spectrogram(log=True)
    fig = tr.spectrogram(show=False, log=True)
    ax = fig.axes[0]
    mappable = ax.collections[0]
    plt.colorbar(mappable=mappable, ax=ax)
    
    plt.show()

This is a sample spectrograph I produced with that: Spectrograph showing frequency vs time with a colorbar on the right. The values of the colorbar range from 0 to 120.

If I wanted the colorbar range to go from 0 to 800 rather than 0 to 120, how could I do that? Thank you.

I've so far looked at the documentation for matplotlib.pyplot.colorbar, but I cannot see if there's a way to do what I am trying.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source