Code covered by the BSD License  

Highlights from
MATLAB Contest Statistics

image thumbnail
from MATLAB Contest Statistics by Matthew Simoneau
The code used to generate the "Statistics" page for the MATLABĀ® Contest.

addContourLines(orders,mi,ma,values)
function h = addContourLines(orders,mi,ma,values)

% Calculate score surface.
xlim = get(gca,'xlim');
ylim = get(gca,'ylim');
[xx,yy] = meshgrid(linspace(xlim(1),xlim(2),200),linspace(ylim(1),ylim(2),200));
zz = final(reverse(yy,orders,mi,ma),xx);

% Calculate contour values.
if nargin < 4
    nLines = 20;
    values = final(reverse(logspace(log10(ylim(1)),log10(ylim(2)),nLines),orders,mi,ma),zeros(1,nLines));
end

% Add contour lines to the plot
[null,h] = contour(xx,yy,zz,values);

% Send to back.
kids = get(gca,'Children');
kids(kids == h) = [];
kids(end+1) = h;
set(gca,'Children',kids)

% Color.
lightGray = ones(3,1)*.7;
set(h,'EdgeColor',lightGray)

Contact us at files@mathworks.com