Skip to content

Instantly share code, notes, and snippets.

@henryrossiter
Created April 21, 2018 16:02
Show Gist options
  • Save henryrossiter/4447d1a4844627356a8847fdb87c602b to your computer and use it in GitHub Desktop.
Save henryrossiter/4447d1a4844627356a8847fdb87c602b to your computer and use it in GitHub Desktop.
% Create a mesh plot
h = figure;
x = seed;
y = season_win_pct;
z = tourney_wins;
dt = delaunayTriangulation(x,y) ;
tri = dt.ConnectivityList ;
xi = dt.Points(:,1) ;
yi = dt.Points(:,2) ;
F = scatteredInterpolant(x,y,z);
zi = F(xi,yi);
trisurf(tri,xi,yi,zi)
title('Games Won by seed & win pct')
xlabel('seed')
ylabel('win pct')
zlabel('success')
xlim([0 16])
ylim([.4 1.0])
zlim([0 6])
shading interp
%rotating gif
filename = 'seed_pct_success.gif';
start = -20;
for n = start:.7:40
az = n;
el = 30+.3*n;
view(az, el);
drawnow
% Capture the plot as an image
frame = getframe(h);
im = frame2im(frame);
[imind,cm] = rgb2ind(im,256);
% Write to the GIF File
if n == start
imwrite(imind,cm,filename,'gif', 'Loopcount',inf,'DelayTime',.1);
else
imwrite(imind,cm,filename,'gif','WriteMode','append','DelayTime',.1);
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment