将X轴值添加到图中的峰
亲爱的stackoverflow家族,
我一直在尝试将X轴值放在图中检测到的峰的顶部或位于图中检测到的峰值。基本上,首先,我使用该函数在频谱中找到峰。然后,我想使用这些与峰一致的X轴值,而不仅仅是放置“ X”或任何类型的符号。
感谢您的任何帮助或建议。
代码;
peaks, properties = find_peaks(meanMat1, prominence=1, width=4)
peak_coordinates = list(zip(Ram[peaks], a[peaks]))
print(peak_coordinates)
d=Ram[peaks]
e=c[peaks]
ax.plot(d, e, "x", color = "xkcd:orange")
(在这里,D和E是被检测到的峰。D和E分别给出X轴和Y轴值(在NP.Array中)。)。
Dear StackOverflow family,
I have been trying to put the x-axis values next to, or at the top of the peaks that are detected in the graph. Basically, first I used the function to find the peaks in the spectrum. Then, I want to use these x-axis values that coincide with the peaks, not just only putting "x", or any kind of symbol.
Thank you for any kind of help or suggestion.
The codes;
peaks, properties = find_peaks(meanMat1, prominence=1, width=4)
peak_coordinates = list(zip(Ram[peaks], a[peaks]))
print(peak_coordinates)
d=Ram[peaks]
e=c[peaks]
ax.plot(d, e, "x", color = "xkcd:orange")
(Here, d and e are the peaks that are detected. d and e give x-axis and y-axis values (in np.array), respectively.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用matplotlib 要添加一个字符串,或者在您的特殊情况下,x轴值,将x轴值,x(您的示例中的
d
)添加到轴上)y(e
在您的示例中)在数据坐标中。You can use Matplotlib
text
to add a string, or, in your particular case the x-axis values, to the Axes at location x (d
in your example), y (e
in your example) in data coordinates.