I want to change the sequence of the legend.
See the figure. I want the sequence to be: green and
data2, blue and
data3, black and
data4, red and
Could anyone give a demo?
<img src="https://i.stack.imgur.com/hPvrh.png" alt="enter image description here">
Change the order in which the plots are added to the figure, and then call
legend normally. That should do it.
You can also do it as follows. First get handles to the individual plots:
h1 = plot(1:5); hold on h2 = plot(11:15, 'r');
legend specifying the order:
<img src="https://i.stack.imgur.com/FUGiK.png" alt="enter image description here">
<img src="https://i.stack.imgur.com/z69O3.png" alt="enter image description here">
In case, you have already made the plots or if you added some plot at the end, which want to reorder to somewhere in middle, you can try this way:
1) Go to
show Plot Tools and Dock Figure.
Delete the data (which you want to move to bottom). Then