第一点和最后一点之间的线 [英] Line between first and last point

查看:50
本文介绍了第一点和最后一点之间的线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用plot(x,y)命令绘制图表,其中x和y是数组.在生成的图表中,我用一条线连接了第一个和最后一个点.如何避免要连接的第一个点和最后一个点?

I'm drawing a chart, using the plot(x, y) command where x and y are arrays. In the resulting chart I have the first and last point connected by a line. How to avoid the first and last point to be connected ?

推荐答案

我遇到了类似的问题,如您所见:

I had similar problem as you can see:

之前

我刚刚使用这个对 x 进行了排序:

I just sorted x using this:

x = sorted(x)

如你所见,这条线消失了:(但由于排序导致数据受到干扰).

And the line disappeared as you can see: (But the data is disturbed due to sorting).

排序后

您还必须确保相应的 y 值也应相应地安排给排序后的 x .最终输出在这里:

You must also make sure the respective y values should also be accordingly arranged for the sorted x. The final output is here:

已修复

这篇关于第一点和最后一点之间的线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆