关于对数图像
title('Plot');
subplot(2,2,2);
semilogx(x,y);
title('Semilogx');
subplot(2,2,3);
semilogy(x,y);
title('Semilogy');
subplot(2,2,4);
loglog(x,y);
title('LogLog');
一图多轴
x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
[AX,H1,H2] = plotyy(x,y1,x,y2);
set(get(AX(1),'Ylabel'),'String','Left Y-axis')
set(get(AX(2),'Ylabel'),'String','Reft Y-axis')
统计分布分区
y = randn(1,1000);
subplot(2,1,1);
hist(y,10);
title('Bins = 10');
subplot(2,1,2);
hist(y,50);
title('Bins = 50');
x = [1 2 5 4 8];
y = [x;1:5];
subplot(1,3,1); bar(x); title('A bargraph of vector x');
subplot(1,3,2); bar(y); title('A bargraph of vector y');
subplot(1,3,3); bar3(y); title('A 3D bargraph');
条形图的变化
x = [1 2 5 4 8];
y = [x;1:5];
subplot(1,2,1);
bar(y,'stacked');
title('stacked');
subplot(1,2,2);
barh(y);
title('Horizontal');
扇形
极坐标图
x = 1:100;
theta = x/10;
r = log10(x);
subplot(1,4,1); polar(theta,r);
theta = linspace(0,2*pi,7);r = ones(1,length(theta));
subplot(1,4,2);polar(theta,r);
阶梯与离散图
盒形图和误差条
填充fill
t = (0:2:8)'*pi/4;
x = sin(t);
y = cos(t);
fill(x,y,'y');
axis square off;
text(0,0,'WAIT','Color','black','FontSize',80,...
'FontWeight','bold','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']);
h(1).FaceColor='red';
h(2).FaceColor=[0 1 1];
h(3).FaceColor='black';
legend('Gold','Silver','Bronze')
3D图像
z越小,颜色越深
x = [1:10; 3:12; 5:14];
imagesc(x);
x=linspace(0,1,256);
green=[zeros(length(x),1),x',zeros(length(x),1)];
colormap(green);
colorbar;
3维曲线图
x = -2:0.1:2;
y = -2:0.1:2;
[X,Y] = meshgrid(x,y);
Z = X.*exp(-X.^2-Y.^2);
subplot(1,2,1); mesh(X,Y,Z);
subplot(1,2,2); surf(X,Y,Z);
contour()绘制等高
x = -2:0.1:2;
y = -2:0.1:2;
[X,Y] = meshgrid(x,y);
Z = X.*exp(-X.^2-Y.^2);
subplot(1,3,1); mesh(X,Y,Z);
subplot(1,3,2); surf(X,Y,Z);
subplot(1,3,3);contour(X,Y,Z);
[C,h] = contourf(Z,[-.45:.05:.45]);
clabel(C,h);
axis square;
3维视图
视角
打光
使用light的时候是加光源
多边形