X=-2:2;
Y=[3,5,2,4,1;5,4,2,3,5;3,4,5,2,1];
area(X',Y')
legend('因素 1','因素 2','因素 3')
grid on
X=-2:2;
Y=[3,5,2,4,1;5,4,2,3,5;3,4,5,2,1];
subplot(2,2,1)
bar(X,Y','r')
xlabel('x')
ylabel('y')
colormap(cool)
subplot(2,2,2)
barh(X,Y','grouped')
xlabel('y')
ylabel('x')
colormap(cool)
subplot(2,2,3)
bar(X,Y','stacked')
xlabel('x')
ylabel('\Sigma y')
colormap(summer)
subplot(2,2,4)
barh(X,Y','stacked')
xlabel('y');
ylabel('\Sigma x')
colormap(summer)
x=[200,360,120,400,320];
subplot(2,2,1);
pie(x,[0 0 0 1 0])
subplot(2,2,2),;
pie3(x,[0 0 0 1 0])
subplot(2,2,3);
pie(x(2:5))
subplot(2,2,4)
x=[0.1,0.12,0.21,0.34,0.11];
pie3(x ,{'A','B','C','D','E'})
rhe=2;
theta=0:pi/20:4*pi;
rho=rhe+theta*rhe;
polar(theta,rho,'r')
命令格式 | 功能 |
---|---|
axis auto | 坐标轴取默认值 |
axis manual | 冻结坐标轴,保持坐标轴取值范围不变 |
axis tight | 将在三个方向上的纵高比设为一个值 |
axis fill | 坐标轴取值范围设为绘图所用数据在相应方向上的最大,最小值 |
axis ij | 将二维图形的坐标原点设置在图形左上角,i轴垂直向下,j轴水平向右 |
axis xy | 二维图形坐标轴恢复为系统默认状态 |
axis equal | 使坐标轴在三个方向上的刻度增量相同 |
axis image | 与axis on 相同 |
axis square | 坐标轴在三个方向上的长度相等 |
axis normal | 撤销命令axis equal 与 axis vis3d的操作 |
axis vis3d | 冻结坐标系状态,以便旋转 |
axis off | 坐标轴消隐 |
axis on | 恢复消隐的坐标轴 |
t=0:0.1:4*pi;
y=sin(t);
y1=cos(t);
plot(t,y,':',t,y1,'r*')
xlabel('x 轴 (0--4\pi)','fontsize',12,'fontweight','bold')
ylabel('y 轴','fontsize',12,'fontweight','bold')
title('绘制正弦波和余弦波 Pos=1','fontsize',10,'fontweight','bold','fontangle','italic')
text(pi,0,'\leftarrowsin(\pi)=0')
text(pi,-1,'\leftarrowcos(\pi)=-1')
text(pi/2,0.9,['\uparrowsin(\pi/2)=',num2str(sin(pi/2))])
text(0,-0.6,['绘图日期:',date])
text(0,-0.8,['MATLAB 版本:',version])
legend('正弦波','余弦波')
figure(2)
plot(t,y,':',t,y1,'r*')
title('绘制正弦波和余弦波 Pos=0','fontsize',10,'fontweight','bold','fontangle','italic')
legend('正弦波','余弦波',0)
grid on
figure(3)
plot(t,y,':',t,y1,'r*')
title('绘制正弦波和余弦波 Pos=-1','fontsize',10,'fontweight','bold','fontangle','italic')
text(7*pi/2,0,'\rightarrowcos(\pi*7/2)=0')
legend('正弦波','余弦波',-1)
grid off
MATLAB图形可视化的学习就到这儿,如有写作错误,不吝赐教。