Axes don't move along with grandparent uipanel

1 次查看(过去 30 天)
The following code causes in error whereby, after an initial change in position of an axes parent uipanel's parent, further position changes do not bring the set of axes along with it.
f=figure('units','normalized','position',[.1 .1 .8 .8]);
u=uipanel('units','normalized','position',[.1 .1 .8 .8],'parent',f);
u2=uipanel('units','normalized','position',[.1 .1 .8 .8],'parent',u);
axes('units','normalized','position',[.2 .2 .6 .6],'parent',u2);
pause(0.5);
set(u,'position',[.15 .1 .8 .8]); drawnow; pause(0.5);
set(u,'position',[.2 .1 .8 .8]); drawnow; pause(0.5);
set(u,'position',[.25 .1 .8 .8]); drawnow; pause(0.5);
set(u,'position',[.3 .1 .8 .8]); drawnow;
All of the children of uipanel u should move in tandem as u's position changes and remain centered. However, the axes remain statically located on the screen.
Does a workaround exist for this bug?

采纳的回答

Mike Garrity
Mike Garrity 2015-6-22
What version of MATLAB are you using? That looks like a bug that was fixed in R2014b.
If it's the one I'm thinking off, then fiddling the Position of the figure would often get everything layed out correctly again. Something like this:
set(f,'Position',get(f,'Position')+[0 0 eps eps])
  1 个评论
Marshall
Marshall 2015-6-22
Thanks Mike. I'm currently on R2013a, perhaps I should upgrade. I created a workaround by detecting the location of the axes with respect to higher ancestory and resetting the parent, which fixed the problem in the meanwhile. Your solution may be a bit easier.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Performance 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by