vis_files/generate_plots.js
/// Draws a histogram representing a marginal distribution
Draws a histogram representing a marginal distribution
Draws a histogram representing a marginal distribution
function drawmarginal(vis)
{
	plottype = "marginal";
	cv = resultcv; 
	cv.clearRect(0,0,graphdx,graphdy);
	var li = vis.line[0];
	var xcol = li.xcol;
	var ycol = li.ycol;
	var imax = xcol.length;
	for(i = 0; i < imax; i++){
		var x1 = Math.floor((i+0.25)*graphdx/imax);
		var x2 = Math.floor((i+0.75)*graphdx/imax);
		var y = Math.floor(graphdy-graphdy*(ycol[i]-axymin)/(axymax-axymin));
		fillrect(x1,y,x2-x1,graphdy-y,RED);  
	}
	if(li.errbarmin){	
		var dx = graphdx/imax;
		var tic = 4;
		if(tic > dx/4) tic = dx/4;
		for(i = 0; i < imax; i++){
			draw_errorbar(Math.floor((i+0.5)*graphdx/imax),ycol[i],li.errbarmin[i],li.errbarmax[i],tic);
		}
	}
	if(vis.line.length > 1){
		var li = vis.line[1];
		var ycol = li.ycol;
		for(i = 0; i < imax; i++){
			var x1 = Math.floor((i)*graphdx/imax);
			var x2 = Math.floor((i+1)*graphdx/imax);
			var y = Math.floor(graphdy-graphdy*(ycol[i]-axymin)/(axymax-axymin));
			drawline(x1,y,x2,y,BLACK,2,0);
		}
	}
}
function drawmarginal ( vis ) { plottype = "marginal" ; cv = resultcv ; cv . clearRect ( 0 , 0 , graphdx , graphdy ) ; var li = vis . line [ 0 ] ; var xcol = li . xcol ; var ycol = li . ycol ; var imax = xcol . length ; for ( i = 0 ; i < imax ; i ++ ) { var x1 = Math . floor ( ( i + 0.25 ) * graphdx / imax ) ; var x2 = Math . floor ( ( i + 0.75 ) * graphdx / imax ) ; var y = Math . floor ( graphdy - graphdy * ( ycol [ i ] - axymin ) / ( axymax - axymin ) ) ; fillrect ( x1 , y , x2 - x1 , graphdy - y , RED ) ; } if ( li . errbarmin ) { var dx = graphdx / imax ; var tic = 4 ; if ( tic > dx / 4 ) tic = dx / 4 ; for ( i = 0 ; i < imax ; i ++ ) { draw_errorbar ( Math . floor ( ( i + 0.5 ) * graphdx / imax ) , ycol [ i ] , li . errbarmin [ i ] , li . errbarmax [ i ] , tic ) ; } } if ( vis . line . length > 1 ) { var li = vis . line [ 1 ] ; var ycol = li . ycol ; for ( i = 0 ; i < imax ; i ++ ) { var x1 = Math . floor ( ( i ) * graphdx / imax ) ; var x2 = Math . floor ( ( i + 1 ) * graphdx / imax ) ; var y = Math . floor ( graphdy - graphdy * ( ycol [ i ] - axymin ) / ( axymax - axymin ) ) ; drawline ( x1 , y , x2 , y , BLACK , 2 , 0 ) ; } } }
Draws a histogram representing a marginal distribution
Draws a histogram representing a marginal distribution