How to automatically increase page size in exportgraphics?

6 views (last 30 days)
I have the following code, which creates the attached image:
f = figure('visible','off');
t = tiledlayout(1,2,'Padding','none','TileSpacing','compact');
t.Units = 'centimeters';
t.OuterPosition = [0.1 0.1 22 9];
nexttile;
heatmap(denormPrimaryGrid,denormSecondaryGrid,gridProbs,...
'CellLabelColor','none',...
'Colormap',flipud(redgreencmap));
ax = gca;
ax.FontSize = 5;
nexttile;
heatmap(denormPrimaryGrid,denormSecondaryGrid,gridProbs,...
'CellLabelColor','none');
ax = gca;
ax.FontSize = 5;
exportgraphics(t,'orig.pdf','BackgroundColor','none','ContentType','vector');
I'd like to enlarge this a bit, so make the following code changes and re-export. But matlab refuses to change the size and just chops off left side:
f = figure('visible','off');
t = tiledlayout(1,2,'Padding','none','TileSpacing','compact');
t.Units = 'centimeters';
t.OuterPosition = [0.1 0.1 27 12];
nexttile;
heatmap(denormPrimaryGrid,denormSecondaryGrid,gridProbs,...
'CellLabelColor','none',...
'Colormap',flipud(redgreencmap));
ax = gca;
ax.FontSize = 5;
nexttile;
heatmap(denormPrimaryGrid,denormSecondaryGrid,gridProbs,...
'CellLabelColor','none');
ax = gca;
ax.FontSize = 5;
exportgraphics(t,'orig.pdf','BackgroundColor','none','ContentType','vector');

Accepted Answer

Nishant Gupta
Nishant Gupta on 27 May 2020

More Answers (0)

Categories

Find more on Printing and Saving in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!