Friday, December 13, 2019

Pattern Drawing 5


from IPython.display import HTML
HTML("""<script src='https://code.highcharts.com/highcharts.js'></script>
<div id='container2' 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(12800).fill(k).map((k,t)=>
    [k*(Math.cos(0.001*t)+Math.sin(a*0.001*t)/2-Math.cos(b*0.001*t)/6),
     k*(Math.sin(0.001*t)+Math.cos(a*0.001*t)/2-Math.sin(b*0.001*t)/6)]);};
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=3;
var a=getinteger(7,19),b=getinteger(18,64);
for (i=1; i<n+1; i++) {series.push({name:i.toString(),color:col(i),
                                    lineWidth:0.5,data:ar(i,a,b)})};
Highcharts.chart('container2', {
    chart:{type:'line',backgroundColor:'mintcream'},
    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