MATLAB export_fig crops title

조회 수: 17 (최근 30일)
Sindre Hodneland
Sindre Hodneland 2020년 7월 18일
댓글: Diaa 2020년 9월 13일
I am trying to export pdf figures with the export_fig function, but it is cropping away the title. it is doing a nice cropping job at the other axis but not the north one. My code is
t = 0:0.01:10;
s1 = 0.7*sin(6*t) + sin(9*t) + 2*sin(14*t);
plot(t,s1,'LineWidth',0.5)
xlabel('Time[s]')
ylabel('y(t)')
title('This is a title')
set(gca,'FontSize',16);
export_fig( './sinewave_with_noise', '-pdf','-transparent')
The above code produces this figure
I know I can '-nocrop':
export_fig( './sinewaves', '-pdf','-transparent','-nocrop')
to get the title back, but then it is not cropped on the west and east axis, like below
Anyone had this issue, or have a workaround?
Thanks for any comments!

채택된 답변

Yair Altman
Yair Altman 2020년 7월 18일
This is fixed in the latest version of export_fig (3.09). In the future, report such issues in export_fig's issues page: https://github.com/altmany/export_fig/issues

추가 답변 (1개)

Image Analyst
Image Analyst 2020년 7월 18일
If you have r2020a, you can try exportgraphics() instead.
  댓글 수: 2
Sindre Hodneland
Sindre Hodneland 2020년 7월 18일
This worked as well!
Diaa
Diaa 2020년 9월 13일
Simplest solution. Thanks for pointing this out.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by