%%
x = [1 2 5 4 8];
y = [x;1:5];
barh(y,'stacked');
title('Exercise: stack the horizontal bar chart');
%%
a = [10 5 20 30];
pie3(a,[1 1 1 1]);
title('Exercise: separate all the pieces in the pie chart')
%%
theta = linspace(0, 2*pi, 7); r = ones(1,length(theta));
polar(theta,r);
title('Exercise: plot a hexagon(六边形) on a polar chart')
%%
t=linspace(0,10,50);f=sin((pi*t.^2)/4);
hold on;
plot(t,f,'b');
stem(t,f,'color','r');
yticks([-1 -0.5 0 0.5 1]);
hold off;
%%
t =(0:3)'*pi/2; x = sin(t); y = cos(t);
fill(x,y,'y','linewidth',5); axis square off;
text(0,0,'WAIT','Color', 'k', 'FontSize', 70,...
'FontWeight','bold','fontname','AMGDT',...
'HorizontalAlignment', 'center');
%%
G = [46 38 29 24 13]; S = [29 27 17 26 8];B = [29 23 19 32 7];
h = bar(1:5, [G' S' B']);
title('Medal count for top 5 countries in 2012 Olympics');
ylabel('Number of medals'); xlabel('Country');
legend('Gold', 'Silver', 'Bronze')
set(gca,'XTickLabel',{'USA','CHN','GBR','RUS','KOR'});
set(h(1),'facecolor',[1 0.8 0.2]); set(h(2),'facecolor',[0.8 0.8 0.8]);set(h(3),'facecolor',[0.8 0.4 0]);
%%
x = -3.5:0.2:3.5; y = -3.5:0.2:3.5;
[X,Y] = meshgrid(x,y); Z = X.*exp(-X.^2-Y.^2);
[C,h] = contourf(Z,[-.45:.05:.45]);
clabel(C,h); axis square;