如何绘制一条最适合最大值的线
How do I draw a no linearline of best fit for the max values like the one in red below? I want to find the max y value for each x value. For example when x is 10 the max y is 2.5. When x is 20 the max y is 4. I then want to plot a line of best fit between these points.
The x and y values are coming from a table.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不太明白这个问题(下次尝试提供更多信息),我认为您想要一条只有最大值的行,而忽略了所有其他信息。因此,为此,您可以在Python中列出与此相似(伪代码)的列表,
然后我将使用Scipy使用插值。 scipy interpolation文档
我可能会选择使用RBF,但是有很多插值方法,您可以四处寻找最合适的方法。将表输入插值后,将为您提供一个与这些点匹配的方程式(或最佳拟合线,取决于您使用的方法)。然后,您可以绘制此方程式,这将是您最大值的最佳拟合行。
I don't quite understand the question (try to provide more information next time), I think you want a line that goes along just the max y values, and ignores all others. So to do this you could you could make a list in python similar to this (pseudocode)
Then I would use interpolation using scipy. Scipy Interpolation Docs
I would probably choose to use RBF, but there are plenty of interpolation methods, you can look around for the one that is best fit. After inputting your tables into the interpolation, you will be given an equation that matches these points (or the line of best fit, depending what method you use). You can then graph this equation, and it will be your line of best fit for only the max y values.