zoukankan      html  css  js  c++  java
  • matlab 中 hold on 和hold off的使用

    hold on 使当前轴及图形保持而不被刷新,准备接受此后将绘制的图形,多图共存

    hold off 使当前轴及图形不在具备被刷新的性质,新图出现时,取消原图

    hold on 在当前图的轴(坐标系)中画了一幅图,再画另一幅图时,原来的图还在,与新图共存,都看得到
    close all
    x=0:2:100;
    y1=2*x;
    y2=3*x;
    y3=3.5*x;
    ph1=plot(x,y1,'r-'); hold on
    ph2=plot(x,y2,'g--');
    ph3=plot(x,y3,'b:');
    title('fake data')
    xlabel('my x data');
    ylabel('my y data');
    th1=text(x(13),y1(13),'red line');
    th2=text(x(15),y2(15),'green line');
    th3=text(x(17),y3(17),'blue line');
    set(th1,'Color','r');
    set(th2,'Color','g');
    set(th3,'Color','b')
    lh=legend([ph1 ph2 ph3],{'x2';'x3';'x3.5'})
    matlab <wbr>中 <wbr>hold <wbr>on <wbr>和hold <wbr>off的使用

    hold off 在当前图的轴(坐标系)中画了一幅图,此时,状态是hold off,则再画另一幅图时,原来的图就看不到了,在轴上绘制的是新图,原图被替换了
    close all
    x=0:2:100;
    y1=2*x;
    y2=3*x;
    y3=3.5*x;
    ph1=plot(x,y1,'r-'); hold off
    ph2=plot(x,y2,'g--');
    ph3=plot(x,y3,'b:');
    title('fake data')
    xlabel('my x data');
    ylabel('my y data');
    th1=text(x(13),y1(13),'red line');
    th2=text(x(15),y2(15),'green line');
    th3=text(x(17),y3(17),'blue line');
    set(th1,'Color','r');
    set(th2,'Color','g');
    set(th3,'Color','b')
    lh=legend([ph1 ph2 ph3],{'x2';'x3';'x3.5'})
    matlab <wbr>中 <wbr>hold <wbr>on <wbr>和hold <wbr>off的使用

     
  • 相关阅读:
    Codeforces Round #352 (Div. 1) B. Robin Hood (二分)
    Codeforces Round #209 (Div. 2) D. Pair of Numbers (模拟)
    Kattis
    kattis Curious Cupid (莫队算法)
    HYSBZ
    SPOJ NETADMIN
    day26-2 基于TCP协议的套接字编程
    day26-1 TCP三次握手和四次挥手
    day25-2 OSI协议和socket抽象层
    day25-1 网络架构与互联网组成
  • 原文地址:https://www.cnblogs.com/hyb221512/p/12848918.html
Copyright © 2011-2022 走看看