How to change the visibility of another layer on a figure written by Matlab when I finished the plot?

The shape file is saved. When several lines intersect, I want to make one of the lines visible. How can I change another layer of lines without redrawing the picture?

+4
source share
2 answers

Use uistack (see doc ). For example, after:

 figure hold on hblue=plot([1 2],[3 4],'b','LineWidth',5); hred=plot([1 2],[4 3],'r','LineWidth',5); 

the red line is on top (and the blue line will not be visible if the red line has covered it). Then, if you use uistack(hblue,'top') , a blue line is displayed at the top. Other options for changing the order of the charts instead of top are up , down and bottom . You can specify the number of steps up or down (for example, uistack(h,'up',2) to move the handle two layers up - although in my simple example it is not necessary).

If, as you say, “the hblue file is saved” and you don’t have grips for graphs ( hblue and hred in my example), after loading the plot you can get it with get(gca,'children') .

+3
source

If you understand correctly, try using hold on before plotting ...

+1
source

All Articles