from IPython.display import HTML
HTML("""<script src='https://cdn.plot.ly/plotly-latest.min.js'></script>
<div id='test_plotly' style='width:600px;height:600px;'/>
<script>TEST=document.getElementById('test_plotly');
function f(t) {return Math.exp(Math.pow(Math.cos(0.001*t),2)+Math.sin(0.001*t))-3*Math.cos(0.004*t);};
function arx(a) {return Array(6400).fill(1+0.1*a).map((r,t) => r*f(t)*Math.cos(0.001*t));};
function ary(a) {return Array(6400).fill(1+0.1*a).map((r,t) => r*f(t)*Math.sin(0.001*t));};
function col(a) {return 'rgb('+(1-0.05*a).toString()+',0,'+(0.05*a).toString()+')';};
function plt(a) {return Plotly.plot(TEST,[{x:arx(a),y:ary(a),line:{color:col(a)},name:a.toString()}]);};
for (i=1; i<20; i++) {plt(i);}
</script>""")
No comments:
Post a Comment