
Chart objects are not displayed in tiled layout
조회 수: 7 (최근 30일)
이전 댓글 표시
I made (1,3) tiledlayout and tried to plot some chart and primitive objects to each tile by following code.
figure
tiledlayout(1,3)
%plot a rectangle and a parameterized function line to the first tile.
nexttile
ti=rectangle('Position',[0,0,b,l]);
hold on
path=fplot(@(t) pathX(t),@(t) pathY(t),[t0,0]);
%plot a rectangle and a quiver to the second tile.
nexttile
ti=rectangle('Position',[0,0,b,l]);
hold on
ver=quiver(x,y,vx,vy);
%plot a parameterized function line and a polygon to the third tile.
nexttile
path=fplot(@(t) pathX(t),@(t) pathY(t),[t0,0]);
hold on
rect=rotate(rect0,omega,[Xtc,Ytc]);
plot(rect);
However, I can't see the Objects in the first and second tiles, although the Property Inspector shows each Axes contains the objects I tried to plot.
댓글 수: 0
답변 (1개)
Vedant Shah
2025년 4월 28일
The reason the objects are not visible in the first and second tiles, despite their presence in the Property Inspector, is due to the absence of explicit axis settings in the provided code. Without setting the axis limits, MATLAB may use default values that do not incorporate the plotted objects, resulting in their invisibility.
To ensure all objects are displayed as intended, it is recommended to explicitly set the axis properties at the end of each tile’s plotting commands. This can be achieved by adding the following lines:
axis equal
axis([xmin xmax ymin ymax])
Here, “xmin” and “xmax” should be replaced with the minimum and maximum values of the x-data, while “ymin” and “ymax” correspond to the minimum and maximum values of the y-data. Adjusting these values according to the plotted data will ensure that all objects are visible within the axes.
I tried adding the above lines of code to the existing code and executing it for a sample data, the results I obtained are as below where all the tiles contain the proper figure as intended:

For more information, please refer to the following documentation:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!