Chart objects are not displayed in tiled layout

8 ビュー (過去 30 日間)
Hiroko Muneoka
Hiroko Muneoka 2022 年 4 月 6 日
回答済み: Vedant Shah 2025 年 4 月 28 日
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.

回答 (1 件)

Vedant Shah
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:

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by