How to get rid of annoying extra white spaces on the margins when exporting surface plots to pdf?

12 ビュー (過去 30 日間)
hmhuang
hmhuang 2022 年 2 月 12 日
回答済み: Matt J 2022 年 2 月 13 日
How to get rid of annoying extra white spaces on the margins when exporting surface plots to pdf, in spite of the use of exportgraphics already? I guess the extra white spaces are caused by the use of view([-25 50]), which changes the default viewpoint, but this line is required for my application.
Example code:
[X,Y,Z] = peaks;
surf(X, Y, Z);
view([-25 50]); %%% This line is necessary, but seems resulting in extra white spaces on the margins
exportgraphics(gcf, 'mypdf.pdf');
  4 件のコメント
Catalytic
Catalytic 2022 年 2 月 12 日
Do you mean the extra blue at the fringe? I definitely don't see that.
hmhuang
hmhuang 2022 年 2 月 13 日
@Catalytic I mean those white space between the blue fringe and the actual surface plot. The blue fringe means the image border when saving as a pdf file.

サインインしてコメントする。

回答 (1 件)

Matt J
Matt J 2022 年 2 月 13 日
Use export_fig instead,
It will crop the borders by default.

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by