How to change the order of lines in a Matlab figure?

后端 未结 4 974
旧巷少年郎
旧巷少年郎 2020-12-08 13:55

Given a plot of three curves in a .fig file I\'d like to add another plot (with hold all and plot), but put it behind one of the already e

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-08 14:47

    The Children property holds the references and the order dictates the graphics stack.

    Another option how to retrieve the list is

    gcaChildrenList=gca.Children;
    

    This way you can play with the orders like

    gca.Children=gca.Children([2:end 1]);         % Put the topmost graphic in the bottom
    gca.Children=gca.Children([end:-1:1]);        % Flip the stack
    gca.Children=gca.Children([1:N-1 N+1:end N]); % Put Nth graphics ontop the stack
    

    Tested on Matlab R2014b

提交回复
热议问题