MatLab----基本的绘图功能(中)+hold 的问题

一、plot的默认情况

x=2:7;
y=[2 5 6 3 6 5];
plot(x,y);与plot(x,y,'-');一样;

二、关于hold的问题;

1.hold on与hold off  在两者之间的时候,所有的线条一起显示;

x=2:7;
y=[2 5 6 3 6 5];
hold on;  %画布开启,不擦除
plot(x,y,'-');

plot(x+1,y,'r*-.');

plot(x+2,y,'gs--');
hold off; %画布关闭

三、画布figure的创建

x=2:7;
y=[2 5 6 3 6 5];

plot(x,y,'-');    %里面包含着figure1的创建 figure1 active
xlabel('时间 1');
ylabel('温度1 ');
figure();       %figure1 inactive figure2 active
plot(x+1,y,'r*-.');
xlabel('时间 2');
ylabel('温度12');
figure(1);      %figure1 active figure2 inactive

 四、clf

clf;%清空figure 窗口,清空里面的所有;

cla;清空坐标系,如果一个figure窗口中有两个画布,点击哪个就是激活哪个,然后对里面的图进行清空;

五、figure window

在MatLab环境中,也就是在脚本文件中,如果此时figure1激活,但是鼠标点击了figure2,此时就是figure2激活,而figure1处于未激活的状态;

posted @ 2022-04-14 11:05  无敌小金刚  阅读(384)  评论(0)    收藏  举报