// 2D plot of a matrix using circles on the current figure // M(i, j) is reprented by a circle centered at xc=j-0.5 and yc=i-0.5 // so M(1,1) is at the left bottom of the plot (origin of the coordinate system) // The radius of the circle is given by the value M(i,j) and it's color is given // by int(M(i,j)*n_colors) (where n_colors is the number of colors in the current // figure). function Matplot2(M, threshold) h=gcf(); // Scale the axis a=gca(); [i, j]=size(M); n_circles=i*j; a.data_bounds=[0.0 0.0; i, j]; // Scale data in [0,1] min_data=min(M); max_data=max(M); if min_data~=max_data then M=(M(:)-min_data)/(max_data-min_data); else M=M(:)/max_data; end drawlater() // Colormap scale n_colors=size(h.color_map, 1); arcs=zeros(6, n_circles); colors=zeros(n_circles); // All the combination of matrix coordinates [I, J]=ndgrid(1:i, 1:j); I = I(:); J = J(:); // The scaled value of M gives the diameter of the circle (W and H components of arcs) DIAM=M(:); DIAM(find(DIAM