matplotlib中的收缩椭圆体

时间:2019-07-01 15:37:08

标签: python matplotlib animation

我是Matplotlib动画的新手,我正在尝试制作一个缩小的椭圆动画。

具体来说,我想为一个椭圆形动画,使其轴按比例缩小。 (从数学上来说,我正在寻找一个收缩因子e ^(-t)乘以每个轴,其中t是时间。)

我已经设定了时间t的函数,该函数使用以下代码输出静态椭球:

         function myFunction() {
           var input, filter, table, tr, td, i,alltables;
             alltables = document.querySelectorAll("table[data-name=myTable]");
           input = document.getElementById("searchbar");
           filter = input.value.toUpperCase();
           alltables.forEach(function(table){
               tr = table.getElementsByTagName("tr");
               for (i = 0; i < tr.length; i++) {
                 td = tr[i].getElementsByTagName("td")[1];
                 if (td) {
                   if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
                     tr[i].style.display = "";
                   } else {
                     tr[i].style.display = "none";
                   }
                 }       
               }
           });
         }

我看过动画(例如此处的https://pythonmatplotlibtips.blogspot.com/2018/11/animation-3d-surface-plot-funcanimation-matplotlib.html),该动画使您可以对3D绘图进行动画处理,其中将z定义为x,y的函数。但是,在椭圆形缩小的情况下,我需要使用球形坐标,这会使事情变得复杂。

有人可以解释要添加到我的代码中的内容,从静态到所需的缩小动画吗?

0 个答案:

没有答案