How can I specify to which figure a plot should go?

前端 未结 2 1420
暗喜
暗喜 2021-02-12 22:36

I have multiple figures open, and I want to update them independently during runtime. The following toy example should clarify my intention:

clf;

figure(\'name         


        
2条回答
  •  旧巷少年郎
    2021-02-12 23:05

    You can use something like

    figure(1)
    plot(x,y) % this will go on figure 1
    
    figure(2)
    plot(z,w) % this will go on another figure
    

    The command will also set the figure visible and on top of everything.

    You can switch back and forth between the figures as necessary by issuing the same figure command. Alternatively, you can use the handle to the figure as well:

    h=figure(...)
    

    and then issue figure(h) instead of using numeric indices. With this syntax, you can also prevent the figure from popping up on top by using

    set(0,'CurrentFigure',h)
    

提交回复
热议问题