How to avoid automatic resizing of axes
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Graphics Object Properties in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!