Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bring axes to front without redrawing the figure?

Is there a way in Matlab to bring an axes to front without having Matlab perform a redraw (drawnow) implicitly?

Background to my question: I am preparing a large figure with several subplots. In some of them I have 2 axes superposed, because I want to see the same data on 2 different y-scales. After playing around with axes settings, I finally got the figure to look like I expected.

But: I need to bring one of the axes to front (in my case, the left axes hAxL). So I have this line in my code: axes(hAxL); This works, but, it seems that Matlab not only brings the axes to front, but also redraws the figure.

That's a pity because I am preparing the entire figure with 'visible','off' to accelerate it. The implicit drawnow blows my idea and makes the figure popup several times, which is annoying and takes the code longer to execute...

I have already tried this: set(gcf ,'CurrentAxes',hAxL), but it only makes hAxL the current axes and does not bring it to front. Any idea on how to solve this?

like image 544
user986990 Avatar asked Aug 06 '14 10:08

user986990


1 Answers

This is also a pretty simple solution that should work for that situation.

set(hAxL ,'Layer', 'Top')
like image 107
Seth_P Avatar answered Oct 04 '22 19:10

Seth_P