Jul-29-2022, 03:30 PM
I am trying to change the values of the axes so that the x and y values (0.3,0.4) and (0.3,1) are shown on the axes for the points. Anyone know how to properly do this?
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:] plt.figure(1) plt.axis([0,100, 0,100]) plt.imshow(zf) plt.show()