Tile spacing with modified aspect ratios

55 visualizaciones (últimos 30 días)
Eric Roden
Eric Roden el 5 de Sept. de 2022
Editada: Dolly More el 10 de Ag. de 2023
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 comentarios
Eric Roden
Eric Roden el 5 de Sept. de 2022
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 el 10 de Ag. de 2023
Editada: Dolly More el 10 de Ag. de 2023
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.

Iniciar sesión para comentar.

Respuesta aceptada

Geetla Sindhu
Geetla Sindhu el 8 de Sept. de 2022
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 comentarios
Eric Roden
Eric Roden el 11 de Sept. de 2022
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 el 10 de Ag. de 2023
Editada: Dolly More el 10 de Ag. de 2023
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?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by