Removing the grey margin of a plot (follow up question)
This is a follow-up question to Removing the grey margin of a plot. If I use the same code proposed by @KSSV within a subplot environment, the picture goes out the left margin (and probably the right margin as well):
subplot(1,2,1) % <– If I use subplotm the picture goes out the left (and maybe right) margin
plot(peaks)
title(‘Plot of Peaks Function’)
axis off
ax = gca;
outerpos = ax.OuterPosition;
ti = ax.TightInset;
left = outerpos(1) + ti(1);
bottom = outerpos(2) + ti(2);
ax_width = outerpos(3) – ti(1) – ti(3);
ax_height = outerpos(4) – ti(2) – ti(4);
ax.Position = [left bottom ax_width ax_height];
Is there a way to correctly adjust the left (and maybe the right) margin, in such a way that the entire figure lies inside the subplot?This is a follow-up question to Removing the grey margin of a plot. If I use the same code proposed by @KSSV within a subplot environment, the picture goes out the left margin (and probably the right margin as well):
subplot(1,2,1) % <– If I use subplotm the picture goes out the left (and maybe right) margin
plot(peaks)
title(‘Plot of Peaks Function’)
axis off
ax = gca;
outerpos = ax.OuterPosition;
ti = ax.TightInset;
left = outerpos(1) + ti(1);
bottom = outerpos(2) + ti(2);
ax_width = outerpos(3) – ti(1) – ti(3);
ax_height = outerpos(4) – ti(2) – ti(4);
ax.Position = [left bottom ax_width ax_height];
Is there a way to correctly adjust the left (and maybe the right) margin, in such a way that the entire figure lies inside the subplot? This is a follow-up question to Removing the grey margin of a plot. If I use the same code proposed by @KSSV within a subplot environment, the picture goes out the left margin (and probably the right margin as well):
subplot(1,2,1) % <– If I use subplotm the picture goes out the left (and maybe right) margin
plot(peaks)
title(‘Plot of Peaks Function’)
axis off
ax = gca;
outerpos = ax.OuterPosition;
ti = ax.TightInset;
left = outerpos(1) + ti(1);
bottom = outerpos(2) + ti(2);
ax_width = outerpos(3) – ti(1) – ti(3);
ax_height = outerpos(4) – ti(2) – ti(4);
ax.Position = [left bottom ax_width ax_height];
Is there a way to correctly adjust the left (and maybe the right) margin, in such a way that the entire figure lies inside the subplot? margin, subplot, outerposition, tightinset, margins MATLAB Answers — New Questions