フィルターのクリア

When zooming, 3D plotted data exceeds uipanel extent despite axes being clipped

3 ビュー (過去 30 日間)
Evan
Evan 2012 年 12 月 14 日
コメント済み: Bineet_Mehra 2016 年 5 月 2 日
I'm working with a GUI which has a number of uicontrols as well as a set of axes. I would like the user to be able to zoom in on data plotted in the axes without the axes filling up the entire GUI.
To accomplish this, I've placed the axes inside a uipanel. This seems to work for the empty axes, as the axes do not exceed the bounds of the panel, even when zoomed.
However, this does not seem to work for data plotted in the axes. While the axes plot area is confined or clipped to the uipanel area, the data exceeds the bounds and overfills the GUI when the zoom feature is used.
The below code reproduces my problem. After the first seven lines, the axes still remain confined. After running the eighth line, zooming in and out on the plotted data shows the problem.
f = figure;
p = uipanel('Position',[0.1 0.1 0.8 0.8],...
'Clipping','on');
a = axes('Parent',p,...
'Position',[0.2 0.2 0.6 0.6]);
plot3(1,1,1)
cla
points = [1 1 4 4 1; 0.5 0.5 -0.5 -0.5 0.5; 1 3 3 1 1];
plot3(points(1,:),points(2,:),points(3,:),'r');
Here are two images, one set to default zoom and one zoomed in enough to show the problem:
  3 件のコメント
Silvia
Silvia 2014 年 2 月 24 日
Hi Evan,
I have the same problem you are telling us. Did you solve it? How did you solve it? clipping is not working. Thank you very much.
Evan
Evan 2014 年 5 月 6 日
編集済み: Evan 2014 年 5 月 6 日
Hi Silvia. Unfortunately, I was not able to find a way to solve this problem. Sorry for the late response.

サインインしてコメントする。

採用された回答

Evan
Evan 2015 年 2 月 12 日
While I'm able to replicate this in previous MATLAB versions R2012a, R2012b, R2014a as well as some releases prior to 2011, this clipping problem does not occur under the new graphics system in MATLAB R2014b. I'm marking this complete for this reason.

その他の回答 (3 件)

Jan
Jan 2013 年 8 月 2 日
編集済み: Jan 2013 年 8 月 2 日
As usual for such bugs, it is required to know the Matlab version you are using. Perhaps you are talking about the documented bug 223595:
Text clipping does not work when the axes is on a uipanel using Painters renderer.
But you graphics are not text. But try the workarounds (other renderers) in spite of this.
You find a lot of clipping problems for uipanel, when you ask your favorite internet search engine. Notice that the clipping of the line object might be controlled by the 'Clipping' property of the line object, although it would be more intuitive if this property is inherited from the parent axes. So what happens for:
plot3(points(1,:),points(2,:),points(3,:),'r', 'Clipping', 'on');
But I do not expect this to work, because the documentation states, that the default value is 'on' already.
  1 件のコメント
Bineet_Mehra
Bineet_Mehra 2016 年 5 月 2 日
I have the same problem. For one 3D figure, setting axis limits does not work. any suggestion ? Thanks ;;; Using old verison R2010b

サインインしてコメントする。


Walter Roberson
Walter Roberson 2012 年 12 月 15 日
set the 'Clipping' property of the uipanel itself.
  2 件のコメント
Evan
Evan 2012 年 12 月 17 日
編集済み: Evan 2012 年 12 月 17 日
It appears that the setting of the clipping property isn't affecting the behavior of the panel (sorry, I should have mentioned this in the question). I tried it out in my example code, but neither explicitly setting the property to 'on' during creation of the uipanel or setting the property to 'on' after plotting the data resolves the issue.
Evan
Evan 2013 年 6 月 2 日
And, again, the problem isn't the axes. It's the data plotted on the axes.

サインインしてコメントする。


B Hiriyur
B Hiriyur 2013 年 3 月 31 日
Apparently axes are by default, big brothers to panels as they are higher up in the stack order. I use the following piece of code after plotting 3D data to manually force a panel to be the older child of the parent figure.
% Reset Stack order
hp = get(gca,'Parent');
hc = get(hp,'Children');
if length(hc)==2
if strcmpi(get(hc(1),'type'),'axes') && strcmpi(get(hc(2),'type'),'uipanel')
set(hp,'Children',[hc(2);hc(1)]);
end
end
This forces the axes to be hidden behind the panel when zooming.
  2 件のコメント
Evan
Evan 2013 年 6 月 2 日
While this code does do what you described (hide the axes behind the panel), it doesn't confine the axes when zooming. Instead, the axes remain hidden so long as they do not exceed the size of the panel (as they are "underneath" it). Once you zoom enough, however, the outer edges become visible, as they exceed the size of the panel. So, basically, this seems to do the reverse of what is needed.
Thanks for the tip about the stack order, though! I'll try to play around with it given that knowledge and hopefully figure something out.
Evan
Evan 2013 年 6 月 2 日
And just to clarify: my problem doesn't seem to be the axes themselves not being clipped. It's the data within the axes. My example code, provided above, demonstrates this.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by