Changes in camera viewpoint parameters cannot be constrained within the axial coordinate area?

3 ビュー (過去 30 日間)
For example, I want to display my drawing in the lower left part of the axis area of the figure window, defining position=[0,0,0.5,0.5], but when I change the camera parameter CameraViewAngle, the drawing fills the entire figure area, any suggestions?
% define my axes visual region, bottom left
ax = axes(Position=[0.0,0.0,0.5,0.5]);
% my plot
[X, Y, Z] = sphere(30);
surf(ax, X, Y, Z,FaceColor="none",EdgeColor="black");
% my camera setting
ax.DataAspectRatio = [1,1,1];
ax.CameraPosition = [0,0,0];
ax.CameraTarget = [1,0,0];
ax.CameraUpVector = [0,0,1];
set camera parameter CameraViewAngle
ax.CameraViewAngle = 100
ax =
Axes with properties: XLim: [-1 1] YLim: [-1 1] XScale: 'linear' YScale: 'linear' GridLineStyle: '-' Position: [0 0 0.5000 0.5000] Units: 'normalized' Use GET to show all properties
% ax.Projection = 'perspective';%'orthographic';%'perspective';
then chage view angle to 20,the area displayed in the figure window has also changed
ax.CameraViewAngle = 20
show result:
The position properties of the axes remains unchanged,while the drawing fills the entire figure area? What can I do to get my drawing within the [0,0,0.5,0.5] lower left area?
References:

採用された回答

cui,xingxing
cui,xingxing 2024 年 9 月 12 日
編集済み: cui,xingxing 2024 年 9 月 13 日
After careful investigation and thought, axes itself is camera controlled, and the default parent object is figure, if you want to limit the area, you can do so by specifying Panel, Tab object.
But specifying tiledlayout, uigridlayout object can't work! If anyone knows anything, please let me know.
p = uipanel(Position=[0.0,0.0,0.5,0.5]);
% define my axes visual region, bottom left
ax = axes(p);
% my plot
[X, Y, Z] = sphere(30);
surf(ax, X, Y, Z,FaceColor="none",EdgeColor="black");
% my camera setting
ax.DataAspectRatio = [1,1,1];
ax.CameraPosition = [0,0,0];
ax.CameraTarget = [1,0,0];
ax.CameraUpVector = [0,0,1];
ax.CameraViewAngle = 20
ax =
Axes with properties: XLim: [-1 1] YLim: [-1 1] XScale: 'linear' YScale: 'linear' GridLineStyle: '-' Position: [0.1300 0.1100 0.7750 0.8150] Units: 'normalized' Use GET to show all properties
  2 件のコメント
Jatin
Jatin 2024 年 9 月 12 日
編集済み: Jatin 2024 年 9 月 12 日
I think even using tiled layout does not seem to work here.
% Create a tiled layout with 2 rows and 2 columns
t = tiledlayout(2, 2);
% Access the lower-left tile by specifying the tile index
ax = nexttile(3); % The lower-left tile in a 2x2 grid
% Create the plot within the selected tile
[X, Y, Z] = sphere(30);
surf(ax, X, Y, Z, 'FaceColor', 'none', 'EdgeColor', 'black');
% my camera setting
ax.DataAspectRatio = [1,1,1];
ax.CameraPosition = [0,0,0];
ax.CameraTarget = [1,0,0];
ax.CameraUpVector = [0,0,1];
ax.CameraViewAngle = 20;
cui,xingxing
cui,xingxing 2024 年 9 月 13 日
編集済み: cui,xingxing 2024 年 9 月 13 日
% Create a grid layout with 2 rows and 2 columns
t = uigridlayout([2, 2]);
% Access the lower-left tile by specifying the row and colum
ax = uiaxes(t);
ax.Layout.Row=2;
ax.Layout.Column = 1;
% Create the plot within the selected tile
[X, Y, Z] = sphere(30);
surf(ax, X, Y, Z, 'FaceColor', 'none', 'EdgeColor', 'black');
% my camera setting
ax.DataAspectRatio = [1,1,1];
ax.CameraPosition = [0,0,0];
ax.CameraTarget = [1,0,0];
ax.CameraUpVector = [0,0,1];
ax.CameraViewAngle = 20;
Thanks for the experiment.@Jatin,I switched to gridlayout and it doesn't work too, only panel, tab can limit the area.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCamera Views についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by