I have created a 2D FFT plot using numpy np.fft.fft2
and now I would like to plot a polar grid in this 2D FFT like this image Plot and Plot with polar grid.
I have tried something like:
import numpy as np
from matplotlib import pyplot as plt
ax = plt.subplot(1, 1, 1, projection='polar')
ax.set_theta_direction(-1)
ax.set_theta_offset(np.pi / 2.0)
ax.imshow(brightvv, extent=[makexax[0], makexax[-1], makeyax[0], makeyax[-1]])
plt.show()
But my output was this: Output
Is there easy way to plot the polar grid in my 2D-fft result?
Random data
import numpy as np
from matplotlib import pyplot as plt
a = np.mgrid[:10, :10][0]
data=(np.abs(np.fft.fft2(a)))
imgb=plt.imshow(np.abs(np.fft.fft2(data)))
plt.show()
Following this answer, you can add a polar axis on top of your cartesian plot.
import numpy as np
from matplotlib import pyplot as plt
a = np.mgrid[:10, :10][0]
data = (np.abs(np.fft.fft2(a)))
fig, ax = plt.subplots()
imgb = ax.imshow(np.abs(np.fft.fft2(data)))
ax_polar = fig.add_axes(ax.get_position(), polar=True, frameon=False)
ax_polar.set_yticklabels([])
plt.show()