rescaleing subfigures within figure

1 visualización (últimos 30 días)
Jakob
Jakob el 22 de En. de 2025
Respondida: Samar el 24 de En. de 2025
Dear all
I have the attached figure. There, I implied a ratio of the height and the width for the original figure; after removing the label in subfigure(3,1,1) and subfigure(3,1,2), I moved the subfigure(3,1,2) and subfigure(3,1,3) abit up, to avoid the space between the three subfigures. But now the original ratio between the height and the width is not given anymore. I thought of rescaling the subfigures within the figure without changing the size of the figure. But unfortunately, I did not find a command for this. Did I miss a possible command, or is there a workaround?
I hope my issue is clear. Thank you for the help.
Best Jakob
  2 comentarios
DGM
DGM el 22 de En. de 2025
I don't know of any native tool called subfigure(), though apparently there are multiple different tools by the same name on the File Exchange. None of the tools I've seen create axes as children of a single parent figure. That's what subplot() does. Subfigure() tools create multiple independent tiled figure windows.
See also:
Jakob
Jakob el 22 de En. de 2025
Dear DGM ,
I ment subplot(), sorry. I will have a look at the link thanks
Best
Jakob

Iniciar sesión para comentar.

Respuestas (1)

Samar
Samar el 24 de En. de 2025
Hi @Jakob,
According to what I inferred from the question, I believe you are facing the following issues:
  1. Resizing multiple plots within a single figure and customizing the position of the plots while maintaining the size of plot.
  2. Rescale the subplots within the same figure without changing their size.
  3. The “xticks” vanish when the subplots come very close.
The following solutions can help overcoming the challenges:
  1. For resizing and repositioning multiple plots within the same figure, reference can be taken from the following code snippet in which a similar example is used.
clear all;
% Sample data
x = linspace(0, 10, 100);
y1 = sin(x);
y2 = tan(x);
% Create a 2x1 grid of subplots
figure;
% First subplot (top-left)
subplot(2, 1, 1);
plot(x, y1, 'r');
% Second subplot (bottom-left)
subplot(2, 1, 2);
plot(x, y2, 'b');
ylim([-10, 10]); % Limiting y-axis for tangent
% Adjusting the position of subplots
% Get the handle of each subplot and adjust its position
h3 = subplot(2, 1, 2);
pos = get(h3, 'Position');
set(h3, 'Position', [pos(1), pos(2) + 0.1, pos(3), pos(4)]);
After running this code you can see the I have shifted the “subplot(2,1,2)” a bit up by using “set” function. Using “set” function:
The vector “pos” has values: [left bottom width height]. The explanation for updating values in this vector is explained in the documentation link here in the “Position and Size” section:
2. Overlapping of “xticks” is a feature which allows us to see the signal better by hiding the “xticks”. In the example given above, since I moved the “subplot(2,1,2)” a little up, the xticks are partially hidden for better visibility of the signal in the “subplot(2,1,2)”.

Categorías

Más información sobre Graphics Performance en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by