Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
621 views
in Technique[技术] by (71.8m points)

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

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 existing curves (i.e. make sure the last original curve stays the foreground one). Can this be achieved without having to extract the plot data and re-plotting?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you know the handle of line you want on top (e.g. because you called h = plot(...), you can use uistack

uistack(h,'top')

Alternatively, you can manipulate the order of children of your current axes directly. The following puts the last-most curve on top.

chH = get(gca,'Children')
set(gca,'Children',[chH(end);chH(1:end-1)])

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...