Create figures with different number of images but same sizes
I try to create 2 figures in 2 different scripts.
Script 1 looks like this:
img_sos = rand(64);
img_oar_pixel = rand(64);
img_oar_block = rand(64);
img_sos = img_sos / max(img_sos(:));
img_oar_pixel = img_oar_pixel / max(img_oar_pixel(:));
img_oar_block = img_oar_block / max(img_oar_block(:));
f = figure;
tl = tiledlayout(1, 3, ‘TileSpacing’, ‘compact’, ‘Padding’, ‘compact’);
clim1 = [0 1];
cmap1 = jet;
ax1 = [];
ax1(1) = nexttile;
imagesc(img_sos, clim1);
axis image off;
title(‘Sum-of-Squares’, ‘FontSize’, 10);
ax1(2) = nexttile;
imagesc(img_oar_pixel, clim1);
axis image off;
title(‘Adaptive Kombination (Pixelweise)’, ‘FontSize’, 10);
ax1(3) = nexttile;
imagesc(img_oar_block, clim1);
axis image off;
title(‘Adaptive Kombination (Blockweise)’, ‘FontSize’, 10);
set(ax1, ‘Colormap’, cmap1);
cb1 = colorbar(ax1(end), ‘eastoutside’);
cb1.Label.String = ‘Normierte Signalintensität’;
cb1.Label.FontSize = 10;
cb1.Ticks = 0:0.2:1;
My second script looks like this:
figure; %<—Matt J added
img_oar_rec = rand(64);
img_oar_rec = img_oar_rec/max(img_oar_rec(:));
img_mask = rand(64);
tiledlayout(1, 2, ‘TileSpacing’, ‘compact’, ‘Padding’, ‘compact’);
ax1 = nexttile;
imagesc(img_oar_rec, [0 1]);
axis image off;
colormap(ax1, ‘jet’);
cb = colorbar;
cb.Label.String = ‘Normierte Signalintensität’;
cb.Label.FontSize = 10;
title(‘Adaptive Kombination’, ‘FontSize’, 10);
ax2 = nexttile;
imagesc(img_mask);
axis image off;
colormap(ax2, ‘gray’);
title(‘Binäre Maske’, ‘FontSize’, 10);
As I want to use these figures in a latex report, I want to save these figures as jpg.
But in both figures, the images should have the same size. Same for the titles and colorbar strings.
How can I do that? I should not scale figures in latex.I try to create 2 figures in 2 different scripts.
Script 1 looks like this:
img_sos = rand(64);
img_oar_pixel = rand(64);
img_oar_block = rand(64);
img_sos = img_sos / max(img_sos(:));
img_oar_pixel = img_oar_pixel / max(img_oar_pixel(:));
img_oar_block = img_oar_block / max(img_oar_block(:));
f = figure;
tl = tiledlayout(1, 3, ‘TileSpacing’, ‘compact’, ‘Padding’, ‘compact’);
clim1 = [0 1];
cmap1 = jet;
ax1 = [];
ax1(1) = nexttile;
imagesc(img_sos, clim1);
axis image off;
title(‘Sum-of-Squares’, ‘FontSize’, 10);
ax1(2) = nexttile;
imagesc(img_oar_pixel, clim1);
axis image off;
title(‘Adaptive Kombination (Pixelweise)’, ‘FontSize’, 10);
ax1(3) = nexttile;
imagesc(img_oar_block, clim1);
axis image off;
title(‘Adaptive Kombination (Blockweise)’, ‘FontSize’, 10);
set(ax1, ‘Colormap’, cmap1);
cb1 = colorbar(ax1(end), ‘eastoutside’);
cb1.Label.String = ‘Normierte Signalintensität’;
cb1.Label.FontSize = 10;
cb1.Ticks = 0:0.2:1;
My second script looks like this:
figure; %<—Matt J added
img_oar_rec = rand(64);
img_oar_rec = img_oar_rec/max(img_oar_rec(:));
img_mask = rand(64);
tiledlayout(1, 2, ‘TileSpacing’, ‘compact’, ‘Padding’, ‘compact’);
ax1 = nexttile;
imagesc(img_oar_rec, [0 1]);
axis image off;
colormap(ax1, ‘jet’);
cb = colorbar;
cb.Label.String = ‘Normierte Signalintensität’;
cb.Label.FontSize = 10;
title(‘Adaptive Kombination’, ‘FontSize’, 10);
ax2 = nexttile;
imagesc(img_mask);
axis image off;
colormap(ax2, ‘gray’);
title(‘Binäre Maske’, ‘FontSize’, 10);
As I want to use these figures in a latex report, I want to save these figures as jpg.
But in both figures, the images should have the same size. Same for the titles and colorbar strings.
How can I do that? I should not scale figures in latex. I try to create 2 figures in 2 different scripts.
Script 1 looks like this:
img_sos = rand(64);
img_oar_pixel = rand(64);
img_oar_block = rand(64);
img_sos = img_sos / max(img_sos(:));
img_oar_pixel = img_oar_pixel / max(img_oar_pixel(:));
img_oar_block = img_oar_block / max(img_oar_block(:));
f = figure;
tl = tiledlayout(1, 3, ‘TileSpacing’, ‘compact’, ‘Padding’, ‘compact’);
clim1 = [0 1];
cmap1 = jet;
ax1 = [];
ax1(1) = nexttile;
imagesc(img_sos, clim1);
axis image off;
title(‘Sum-of-Squares’, ‘FontSize’, 10);
ax1(2) = nexttile;
imagesc(img_oar_pixel, clim1);
axis image off;
title(‘Adaptive Kombination (Pixelweise)’, ‘FontSize’, 10);
ax1(3) = nexttile;
imagesc(img_oar_block, clim1);
axis image off;
title(‘Adaptive Kombination (Blockweise)’, ‘FontSize’, 10);
set(ax1, ‘Colormap’, cmap1);
cb1 = colorbar(ax1(end), ‘eastoutside’);
cb1.Label.String = ‘Normierte Signalintensität’;
cb1.Label.FontSize = 10;
cb1.Ticks = 0:0.2:1;
My second script looks like this:
figure; %<—Matt J added
img_oar_rec = rand(64);
img_oar_rec = img_oar_rec/max(img_oar_rec(:));
img_mask = rand(64);
tiledlayout(1, 2, ‘TileSpacing’, ‘compact’, ‘Padding’, ‘compact’);
ax1 = nexttile;
imagesc(img_oar_rec, [0 1]);
axis image off;
colormap(ax1, ‘jet’);
cb = colorbar;
cb.Label.String = ‘Normierte Signalintensität’;
cb.Label.FontSize = 10;
title(‘Adaptive Kombination’, ‘FontSize’, 10);
ax2 = nexttile;
imagesc(img_mask);
axis image off;
colormap(ax2, ‘gray’);
title(‘Binäre Maske’, ‘FontSize’, 10);
As I want to use these figures in a latex report, I want to save these figures as jpg.
But in both figures, the images should have the same size. Same for the titles and colorbar strings.
How can I do that? I should not scale figures in latex. figure, subplot, image, export MATLAB Answers — New Questions