我有一个三维点的列表,按时间排序。有没有办法绘制点,以便我可以获得视觉表示,其中还包括有关点在列表中发生位置的信息?我最初的想法是找到一种方法,按照绘制的顺序对点进行着色。
ListPlot3D
在点上覆盖一张纸,而不考虑它们的绘制顺序。
ListPointPlot
仅显示点,但不指示它们的绘制顺序。在这里,我正在考虑根据点在列表中出现的顺序为点着色。
与许多其他绘图函数不同,ListLinePlot
似乎没有 3D 表兄弟。
I've got a list of three dimensional points, ordered by time. Is there a way to plot the points so that I can get a visual representation that also includes information on where in the list the point occurred? My initial thought is to find a way to color the points by the order in which they were plotted.
ListPlot3D
drapes a sheet over the points, with no regard to the order which they were plotted.
ListPointPlot
just shows the points, but gives no indication as to the order in which they were plotted. It's here that I am thinking of coloring the points according to the order in which they appear in the list.
ListLinePlot
doesn't seem to have a 3D cousin, unlike a lot of the other plotting functions.
发布评论
评论(5)
您也可以执行类似
的操作
You could also do something like
由于您没有提供示例,我通过创建 3d 自回避随机游走来弥补一些:(
这有点问题,但可以完成工作;它在 3d 中产生一个随机游走,它可以避免自身,即避免重新访问同一个地方在后续步骤中)。
然后我们产生 100000 个这样的步骤,
就像我理解你的数据点一样。然后,我们根据具体步骤来更改颜色:
这也可以像其他答案一样一次性完成
,但我倾向于避免这种结构,因为我发现它们更难以阅读和修改。
最后绘制结果:
随着时间的推移,路径变得更红。
如果这就是您想要的东西,我可以详细说明。
编辑:很可能有更简单的方法来做到这一点...
编辑2:显示大量的点来证明这对于在 箭头不会轻易缩放。
EDIT3:添加了单行版本。
As you did not provide examples, I made up some by creating a 3d self-avoiding random walk:
(this is sort of buggy but does the job; it produces a random walk in 3d which avoids itself, ie, avoids revisiting the same place in subsequent steps).
Then we produce 100000 steps like this
this is like I understood your data points to be. We then make these change color depepnding on which step it is:
This can also be done all at once like the other answers
but I tend to avoid this sort of constructions because I find them harder to read and modify.
Finally plot the result:
The path gets redder as time advances.
If this is the sort of thing you're after, I can elaborate.
EDIT: There might well be easier ways to do this...
EDIT2: Show a large set of points to demonstrate that this is very useful to see the qualitative trend in time in cases where arrows won't scale easily.
EDIT3: Added the one-liner version.
我认为海克的方法是最好的,但她让它变得过于复杂,恕我直言。我会使用:
(acl 的数据)
I think Heike's method is best, but she made it overly complex, IMHO. I would use:
(acl's data)
至于你的最后一个问题:如果你想要一种
ListLinePlot3D
而不是ListPointPlot
你可以简单地执行以下操作:当然,这样您就无法设置线条属性,因此如果您想要的话,您必须稍微更改一下规则:
或使用
但是,为什么不只使用 Graphics3D 和一些图形基元呢?
As to your last question: If you want to have a kind of
ListLinePlot3D
instead of aListPointPlot
you could simply do the following:Of course, in this way you can't set line properties so you have to change the rule a bit if you want that:
or with
But then, why don't you use just Graphics3D and a few graphics primitives?