Friday, December 13, 2019

Pattern Drawing 4


from IPython.display import HTML
HTML("""<script src='https://code.highcharts.com/highcharts.js'></script>
<div id='container3' style='height:600px; width:600px; margin:0 auto'></div>
<script>
function getinteger(min,max) {return Math.floor(Math.random()*(max-min+1))+min;};
function ar(k,a,b) {return Array(6400).fill(k).map((k,t)=>
    [Math.cos(0.001*t+k*Math.PI/6)+Math.cos(a*0.001*t)/2+Math.sin((a+b)*0.001*t)/3,
     Math.sin(0.001*t+k*Math.PI/6)+Math.sin(a*0.001*t)/2+Math.cos((a+b)*0.001*t)/3]);};
function col(i) {var r=getinteger(i,255),g=getinteger(i,255),b=getinteger(i,255);
                 return 'rgb('+r.toString()+','+g.toString()+','+b.toString()+')';}; 
var series=[]; var i; var n=6;
var a=getinteger(7,15),b=getinteger(10,48);
for (i=1; i<2*n+1; i++) {series.push({name:i.toString(),color:col(i),
                                      lineWidth:0.5,data:ar(i,a,b)})};
Highcharts.chart('container3', {
    chart:{type:'line',backgroundColor:'lavender'},
    xAxis:{title:{text:'x'}},yAxis:{title:{text:'y'}},
    title:{text:'Random Parametric Plot: a,b = '+[a,b].toString()},
    credits:{enabled:false},legend:{enabled:false},series:series});
</script>""")

No comments:

Post a Comment