(Jul-29-2022, 04:05 PM)deanhystad Wrote: Why? Normally axis labels indicate range with maybe some subdivisions to give approximate value. If you want the real value you click on the plot.
It seems I got the axes right but now the points are not showing up. Do you know whats wrong with my code here?
from scipy.fft import fft2, fftshift import numpy as np import matplotlib.pyplot as plt from skimage.filters import window from scipy.fftpack import fftfreq k = np.linspace(0,4.76*10,2400) kx,ky = np.meshgrid(k, k) x1 = 0.3 y1 = 0.4 x2 = 0.3 y2 = 1 z = 0.05*np.cos(2*np.pi*kx*x1 + 2*np.pi*ky*y1) + 0.05*np.cos(2*np.pi*kx*x2 + 2*np.pi*ky*y2) wz = z * window('hann', z.shape) plt.figure(0) plt.imshow(wz) f = fftfreq(len(k), np.diff(k)[0]) zf = np.abs(fftshift(fft2(wz)))[1200:, 1200:] fig, ax = plt.subplots() ax.set(xlim=(0, 2), ylim=(0, 2)) ax.imshow(zf,extent=[0,f[:k.size//2][-1], 0 , f[:k.size//2][-1]]) plt.show()