Tile spacing with modified aspect ratios

76 ビュー (過去 30 日間)
Eric Roden
Eric Roden 2022 年 9 月 5 日
編集済み: Dolly More 2023 年 8 月 10 日
I am creating a 2 x 2 tiled plot in which each tile has a modified aspect ratio using the pbaspect command, where the modified aspect ratio (3 x 2 x 1) makes each tile plot somewhat less wide than the default setting. However when I set TileSpacing to 'compact', which is what I want to minimize the space between each tile, there is extra space in the middle between the two tiles on the left and the two tiles on the right hand side of the plot. Is there any way to make the TileSpacing command work with the modified aspect ratios? I have pasted in below a simplified version of the code for the plot.
f = figure();
f.WindowState = 'maximized';
asp1=3;
asp2=2;
asp3=1;
p=tiledlayout(2,2);
nexttile
plot(x1,y1);
pbaspect([asp1 asp2 asp3])
nexttile
plot(x2,y2);
pbaspect([asp1 asp2 asp3])
nexttile
hold on
box on
plot(x3,y3);
pbaspect([asp1 asp2 asp3])
nexttile
plot(x4,y4);
pbaspect([asp1 asp2 asp3])
p.TileSpacing = 'compact';
p.Padding = 'compact';
  3 件のコメント
Eric Roden
Eric Roden 2022 年 9 月 5 日
Dear KSSV:
Thanks, yes, I had tried that, to no effect. It seems as if the tile spacing function does not function properly when the aspect ratio of the tiles is changed. Any other ideas anyone?
Best, Eric
Dolly More
Dolly More 2023 年 8 月 10 日
編集済み: Dolly More 2023 年 8 月 10 日
Did p.Position work for you? Its not working for me. I am getting Warning saying "Warning: Unable to set 'Position', 'InnerPosition', 'OuterPosition', or 'PositionConstraint' for objects in a TiledChartLayout "
I tired ltilespacing 'tight' and changed the aspect ratio of one column using pbaspect([1 1 1]) as I need to keep the aspect ratio equal for TS plot. But my plot still has extra white space and size of my squared tiles is also reducing. Can I just give tilespacing "none" for just one column of tiles in the tiledlayout? Please let me know if anything worked for you?
PS: I have attached screenshot of my plot for reference.

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

採用された回答

Geetla Sindhu
Geetla Sindhu 2022 年 9 月 8 日
Hello,
I understand that you are trying to remove the spaces between the tiles by maintaining the aspect ratios.
If you use pbaspect on the axes, this will distribute the axes (which means there is a lot of space in between them). In order to remove the spaces, you can adjust the tiled layout Position (this will keep the axes together, putting the space at one side).
Use p.Position property to adjust the spaces between the tiles.
For example, the plot obtained from the code which was used is shown below
By using
p.Position(2)=0.2;
p.Position(3)=0.5;
p.Position(4)=0.7;
the following plot is obtained.
You can refer to the below documentation for further information:
  2 件のコメント
Eric Roden
Eric Roden 2022 年 9 月 11 日
Dear Geetla:
Thank you this, this was very helpful. Just so I'll know, can you explain exactly what the three Positions correspond to? And also, what would be the value of p.Position (1)?
Kind regards, Eric
Dolly More
Dolly More 2023 年 8 月 10 日
編集済み: Dolly More 2023 年 8 月 10 日
I tried using P.Position for changed aspect ratio tiles. It isn't working for me and I am getting a warning saying 'Unable to change the Position, innerposition and outerposition". Do you know why it might not be working for me?
Also, can I just give tilespacing "none" for just one column of tiles in the tiledlayout?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTwo y-axis についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by