【问题标题】:Animate List on a graph in Mathematica?在 Mathematica 中的图表上制作动画列表?
【发布时间】:2012-10-05 13:58:51
【问题描述】:

我有一个坐标矩阵 (X,Y),我想通过逐点绘制并连接这些点来为它们设置动画。我尝试了“ListAnimate”,但它只为每个坐标的值设置动画..

示例如下:

{{1,1},
{1,2},
{5,4},...}

【问题讨论】:

    标签: animation wolfram-mathematica


    【解决方案1】:

    可能

    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}]
    

    【讨论】:

      【解决方案2】:

      只是一个说明性的答案。以下所有内容也做同样的事情:


      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}]
      

      【讨论】:

        猜你喜欢
        • 2012-04-26
        • 1970-01-01
        • 2012-05-04
        • 1970-01-01
        • 2011-07-11
        • 1970-01-01
        • 1970-01-01
        • 2019-07-31
        • 1970-01-01
        相关资源
        最近更新 更多