How to avoid automatic resizing of axes

조회 수: 9 (최근 30일)
Petrus
Petrus 2013년 10월 9일
편집: Petrus 2013년 10월 9일
I create a simple graphic interface using uicontrol & uipanel that contains 2 axes. My problem is that, when using camva function, the axes size does not keep constant. First axis can overlap second axis.
See a simple example:
function example
fig = figure;
set(fig,'position',[25 75 600 600]);
hp = uipanel('FontSize',12,...
'BackgroundColor','white'...
);
a2 = subplot(1,2,2,'Parent',hp);
plot(a2,rand(1,10),'r');
a1 = subplot(1,2,1,'Parent',hp);
npanels = 72;
erad = 6371008.7714;
[x, y, z] = ellipsoid(0, 0, 0, erad, erad, erad, npanels);
surf(a1,x, y, -z, 'FaceColor', 'b', 'EdgeColor', 0.5*[1 1 1]);
uicontrol('Parent',fig, 'Style','slider', 'Value',2, 'Min',1,...
'Max',10, 'SliderStep',[1 10]./360, ...
'Position',[150 5 300 20], 'Callback',{@slider_callback,a1})
end
function slider_callback(hObj, eventdata,a1)
angle = round(get(hObj,'Value'))
set(a1,'CameraViewAngle',angle);
get(a1,'Position')
end
When using slider callback for the 1st subplot, the sphere can overlap the second subplot. How can I avoid this and enforce that the axes position and size remain the same?
Thanks in adavance, Petrus
Product version: Matlab2007a

답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by