I share this python code that I extracted from here: Plotting a fast Fourier transform in Python. I am making a Fourier spectrum, and then I would like to 'pick' to get the value from a specific point on the plot. In the next picture you can see the 50 Hz frequency, but I would like to know the frequency value of the next peak. How could I find that?
import numpy as np
import matplotlib.pyplot as plt
import scipy.fftpack
N = 600
# sample spacing
T = 1.0 / 800.0
x = np.linspace(0.0, N*T, N)
y = np.sin(50.0 * 2.0*np.pi*x) + 0.5*np.sin(80.0 * 2.0*np.pi*x)
yf = scipy.fftpack.fft(y)
xf = np.linspace(0.0, 1.0/(2.0*T), N//2)
fig, ax = plt.subplots()
ax.plot(xf, 2.0/N * np.abs(yf[:N//2]))
plt.show()