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

조회 수: 12 (최근 30일)
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 CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by