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

5 visualizaciones (últimos 30 días)
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:

Respuesta aceptada

cui,xingxing
cui,xingxing el 12 de Sept. de 2024
Editada: cui,xingxing el 13 de Sept. de 2024
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 comentarios
Jatin
Jatin el 12 de Sept. de 2024
Editada: Jatin el 12 de Sept. de 2024
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 el 13 de Sept. de 2024
Editada: cui,xingxing el 13 de Sept. de 2024
% 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Camera Views en Help Center y File Exchange.

Productos


Versión

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by