Bring axes to front without redrawing the figure?

不羁岁月 提交于 2021-02-18 12:10:45

问题


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?


回答1:


Maybe uistack could be a solution.

Try

uistack(hAxL, 'top')



回答2:


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

set(hAxL ,'Layer', 'Top')


来源:https://stackoverflow.com/questions/25157724/bring-axes-to-front-without-redrawing-the-figure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!