Add margin to pdf files using exportgrahics function
古いコメントを表示
Hi team
I am using exportgrahics function within my loop to append figures as pdf files and merge them in one pdf file as a final outcome. All good except there are absolutely no margin at all. I want to add atleast half an inch margin on all sides (top bottom left right). I have tried different things but can't add margin to my final pdf file. Can someone please help me? I have pasted part of my codes here. You can just generate dummy plots in loop and please use exportgraphics to merge them in pne file as pdf.
If exportgraphics is not suitable function then please let me know alternative codes. I have also attached my output pdf file. Thank you.
% FIG 1
figure;
plot(Date, Close, 'b-', 'LineWidth', 1, 'DisplayName', company);
grid on;
xlabel('Year');
ylabel(company);
xlim([min(Date), max(Date) + 200])
ylim([min(Close), max(Close) * 1.1])
ytickformat('%,.0f');
hold on
scatter(Px, Py, 50, 'green', 'filled', 'DisplayName', 'Positions');
hold off
lgd = legend;
lgd.NumColumns = 3;
yyaxis right; % Secondary axis
plot(Date_N, Close_N, 'k', 'LineWidth', 0.25, 'DisplayName', 'NIFTY-50');
ylabel('NIFTY-50');
xlim([min(Date_N), max(Date_N) + 200])
ylim([min(Close_N), max(Close_N) * 1.1])
set(lgd, 'Location', 'northwest');
title(company, newline);
ax = gca;
ax.YAxis(2).Exponent = 0;
ax.YAxis(1).Color = 'k';
ax.YAxis(2).Color = 'k';
ytickformat('%,.0f');
set(gcf, 'PaperOrientation', 'landscape', 'Visible', 'off', ...
'Position', [100, 100, 1100, 550]);
exportgraphics(gcf, output_pdf, 'Append', true);
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Printing and Saving についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!