What I want to do
Essentially I have the plot on the left (logarithmic scale), with the labels of the plot on the right (linear scale).
I just want to add an equally-spaced logarithmic y-axis (e.g. how the space between 4.2 and 8.7 is the same as the space between 18.3 and 38.3) to my plot, which was generated using logarithmic data but has a linear axis (since this is automatically created by matplotlib).
(Concrete examples of my case below.)
I want to plot this with an evenly-spaced logarithmic y-scale. In other words, I want to evenly space/display nonlinearly spaced frequencies for the y-axis labels.
Right now the y-scale is just linearly extrapolated and completely incorrect.
My code
# Wavelet parameters
min_freq = 1
max_freq = int(fs / 4)
num_freqs = int(max_freq / 2)
freq = np.logspace(np.log10(min_freq), np.log10(max_freq), num_freqs)
sec = 5
n_samples = sec*fs
brain_signal = samples[10*n_samples:11*n_samples]
cwtmatr = signal.cwt(brain_signal, signal.morlet2, freq, w=n)
cwtmatr = np.abs(cwtmatr)**2
t = np.linspace(0, sec, num=n_samples)
plt.pcolormesh(t, freq, cwtmatr, cmap='Spectral', shading='gouraud')
plt.colorbar()
What I've tried
plt.pcolormesh(t, freq, cwtmatr, cmap='Spectral', shading='gouraud')
ax = plt.gca()
ax.yaxis.set_ticks(np.floor(freq[::40]))
plt.colorbar()
For obvious reasons, this leads to many low-valued y-ticks and sparse high-valued ticks
plt.pcolormesh(t, freq, cwtmatr, cmap='Spectral', shading='gouraud')
ax = plt.gca()
ax.set_yscale('log')
plt.colorbar()
Incorrect values and not evenly spaced.