我有一个坐标矩阵(X,Y),我想通过逐点绘制并连接点来为它们设置动画。我尝试了“ListAnimate”,但它只动画了每个坐标的值..
以下是样本的样子:
{{1,1},
{1,2},
{5,4},...}
答案 0 :(得分:4)
可能是
max = 10;
coords = Table[{i, RandomReal[]}, {i, max}];
Animate[ListPlot[coords[[1 ;; n]], PlotMarkers -> {Automatic, Small},
Joined -> True, PlotRange -> {{0, max}, {0, 1}}], {n, 1, max, 1}]
答案 1 :(得分:1)
只是一个说明性的答案。以下所有内容也做同样的事情:
max = 10;
coords = Table[{i, RandomReal[]}, {i, max}];
p = PlotRange -> {{0, max}, {0, 1}};
Animate[
ListLinePlot[coords[[1 ;; n]], Mesh -> All, p],
{n, Range@max}]
Animate[
Graphics[{Point@#, Line@#}, p, Axes -> True] &@coords[[1 ;; n]],
{n, Range@max}]
Animate[
Graphics[{ Red, Point[#],
Black, BSplineCurve[#, SplineDegree -> 1]}, p] &@coords[[1 ;; n]],
{n, Range@max}]