Resizing Subplots Within a Figure
Hi, I have two subplots displayed side-by-side in one figure window, as shown.
Now, the aspect ratio (width-to-height ratio) of each photo is fixed, as is the proportion of the two images in relation to one another. I’d like to make the photos larger while keeping the size of the figure window the same, but I’m running into an issue. Here’s the relevant snippet of my code:
%% DISPLAY IMAGES IN ONE FIGURE
fig = figure;
colormap(flipud(gray));
% Calculate the normalized heights based on image size
heightS = size(maxS, 1) / (size(maxS, 1) + size(maxC, 1));
heightC = size(maxC, 1) / (size(maxS, 1) + size(maxC, 1));
% Calculate the bottom position for vertical centering
bottomS = (1 – heightS) / 2;
bottomC = (1 – heightC) / 2;
% Saggital View
subplot(‘Position’, [0, bottomS, 0.5, heightS]);
imagesc(maxS);
title("Saggital View")
axis off;
axis image;
% Coronal View
subplot(‘Position’, [0.5, bottomC, 0.5, heightC]);
imagesc(maxC);
title("Coronal View")
axis off;
axis image;
set(fig, ‘Position’, [100, 100, 1000, 500]); % Set the position and size of the figure
As you can see, both subplots supposedly have a width of 0.5, meaning they each take up exactly half of the figure window. So why do the images look so small? I have no idea. I’m aware there’s additional space around the image taken up by invisble tick marks, labels, ex. but that doesn’t really explain why the images are so small. I can’t just increase their widths, because that would cause their combined width to exceed the figure size and result in the deletion of one of the subplots entirely. I need a way to make these images bigger without changing their aspect ratios, changing the size of the figure window, or changing the normalization of their values so they scale correclty with regards to one another. Does anyone have any ideas?Hi, I have two subplots displayed side-by-side in one figure window, as shown.
Now, the aspect ratio (width-to-height ratio) of each photo is fixed, as is the proportion of the two images in relation to one another. I’d like to make the photos larger while keeping the size of the figure window the same, but I’m running into an issue. Here’s the relevant snippet of my code:
%% DISPLAY IMAGES IN ONE FIGURE
fig = figure;
colormap(flipud(gray));
% Calculate the normalized heights based on image size
heightS = size(maxS, 1) / (size(maxS, 1) + size(maxC, 1));
heightC = size(maxC, 1) / (size(maxS, 1) + size(maxC, 1));
% Calculate the bottom position for vertical centering
bottomS = (1 – heightS) / 2;
bottomC = (1 – heightC) / 2;
% Saggital View
subplot(‘Position’, [0, bottomS, 0.5, heightS]);
imagesc(maxS);
title("Saggital View")
axis off;
axis image;
% Coronal View
subplot(‘Position’, [0.5, bottomC, 0.5, heightC]);
imagesc(maxC);
title("Coronal View")
axis off;
axis image;
set(fig, ‘Position’, [100, 100, 1000, 500]); % Set the position and size of the figure
As you can see, both subplots supposedly have a width of 0.5, meaning they each take up exactly half of the figure window. So why do the images look so small? I have no idea. I’m aware there’s additional space around the image taken up by invisble tick marks, labels, ex. but that doesn’t really explain why the images are so small. I can’t just increase their widths, because that would cause their combined width to exceed the figure size and result in the deletion of one of the subplots entirely. I need a way to make these images bigger without changing their aspect ratios, changing the size of the figure window, or changing the normalization of their values so they scale correclty with regards to one another. Does anyone have any ideas? Hi, I have two subplots displayed side-by-side in one figure window, as shown.
Now, the aspect ratio (width-to-height ratio) of each photo is fixed, as is the proportion of the two images in relation to one another. I’d like to make the photos larger while keeping the size of the figure window the same, but I’m running into an issue. Here’s the relevant snippet of my code:
%% DISPLAY IMAGES IN ONE FIGURE
fig = figure;
colormap(flipud(gray));
% Calculate the normalized heights based on image size
heightS = size(maxS, 1) / (size(maxS, 1) + size(maxC, 1));
heightC = size(maxC, 1) / (size(maxS, 1) + size(maxC, 1));
% Calculate the bottom position for vertical centering
bottomS = (1 – heightS) / 2;
bottomC = (1 – heightC) / 2;
% Saggital View
subplot(‘Position’, [0, bottomS, 0.5, heightS]);
imagesc(maxS);
title("Saggital View")
axis off;
axis image;
% Coronal View
subplot(‘Position’, [0.5, bottomC, 0.5, heightC]);
imagesc(maxC);
title("Coronal View")
axis off;
axis image;
set(fig, ‘Position’, [100, 100, 1000, 500]); % Set the position and size of the figure
As you can see, both subplots supposedly have a width of 0.5, meaning they each take up exactly half of the figure window. So why do the images look so small? I have no idea. I’m aware there’s additional space around the image taken up by invisble tick marks, labels, ex. but that doesn’t really explain why the images are so small. I can’t just increase their widths, because that would cause their combined width to exceed the figure size and result in the deletion of one of the subplots entirely. I need a way to make these images bigger without changing their aspect ratios, changing the size of the figure window, or changing the normalization of their values so they scale correclty with regards to one another. Does anyone have any ideas? display, figure, plot MATLAB Answers — New Questions