Thursday, December 12, 2019

Histogram Bellcurves


from IPython.display import HTML
HTML("""<script src='https://code.highcharts.com/highcharts.js'></script>
<script src='https://code.highcharts.com/modules/histogram-bellcurve.js'></script>
<div id='container7' style='height:600px; width:600px; margin:0 auto'></div><script>
function get_int(xmin,xmax) {return Math.floor(Math.random()*(xmax-xmin+1))+xmin;};
var n=3000var m=get_int(6,24)
var col='rgb('+get_int(10,240)+','+get_int(10,240)+','+get_int(10,240)+')';
var data=Array(n).fill(m).map((a,t)=>[Math.cos(a*t*0.01)*Math.cos(t*0.01),
                                      Math.cos(a*t*0.01)*Math.sin(t*0.01)]);
Highcharts.chart('container7',{
    title:{text:'Array Histogram: a='+m},
    xAxis:[{title:{text:'Values'},alignTicks:false},
           {title: {text:'Histogram'},alignTicks:false,opposite:true}],
    yAxis:[{title:{text:'Values'}},{title:{text:'Histogram'},opposite:true}],
    series:[{name:'Histogram',type:'histogram',color:'silver',
             xAxis:1,yAxis:1,baseSeries:'s1',zIndex:-1},
            {name:'Data',type:'scatter',color:col,
             data:data,id:'s1',marker:{radius:1.5}}]});
</script>""")

No comments:

Post a Comment