matlab中holdon和holdoff的使⽤
holdon使当前轴及图形保持⽽不被刷新,准备接受此后将绘制的图形,多图共存
holdoff使当前轴及图形不在具备被刷新的性质,新图出现时,取消原图
holdon在当前图的轴(坐标系)中画了⼀幅图,再画另⼀幅图时,原来的图还在,与新图共存,都看得到
cloall
x=0:2:100;
y1=2*x;
y2=3*x;
y3=3.5*x;
ph1=plot(x,y1,'r-');holdon
ph2=plot(x,y2,'g--');
ph3=plot(x,y3,'b:');
title('fakedata')
xlabel('myxdata');
ylabel('myydata');
th1=text(x(13),y1(13),'redline');
th2=text(x(15),y2(15),'greenline');
th3=text(x(17),y3(17),'blueline');
t(th1,'Color','r');
t(th2,'Color','g');
t(th3,'Color','b')
lh=legend([ph1ph2ph3],{'x2';'x3';'x3.5'})
holdoff在当前图的轴(坐标系)中画了⼀幅图,此时,状态是holdoff,则再画另⼀幅图时,原来的图就看不到了,在轴上绘制
的是新图,原图被替换了
cloall
x=0:2:100;
y1=2*x;
y2=3*x;
y3=3.5*x;
ph1=plot(x,y1,'r-');holdoff
ph2=plot(x,y2,'g--');
ph3=plot(x,y3,'b:');
title('fakedata')
xlabel('myxdata');
ylabel('myydata');
th1=text(x(13),y1(13),'redline');
th2=text(x(15),y2(15),'greenline');
th3=text(x(17),y3(17),'blueline');
t(th1,'Color','r');
t(th2,'Color','g');
t(th3,'Color','b')
lh=legend([ph1ph2ph3],{'x2';'x3';'x3.5'})
本文发布于:2022-11-24 13:39:42,感谢您对本站的认可!
本文链接:http://www.wtabcd.cn/fanwen/fan/90/12139.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |