필터 지우기
필터 지우기

Main title of figure removed after print function is used

조회 수: 3 (최근 30일)
Filip Fedorowicz
Filip Fedorowicz 2020년 10월 27일
답변: Kiran Felix Robert 2020년 11월 6일
I am creating a figure with 6 sub figures, all with its own title. At the end I want to display a title using sgtitle for the figure. This works well and then I am exporting my figure using print. However, after the print step, the title of the figure dissappears. Below is a snippet of my script.
summaryTitle = sprintf(summaryTitle, Name,iFrame, percentage,...
SR,DS,answer3,xLength);
sgtitle(summaryTitle, 'Interpreter', 'none');
pdfTitle = Class+"_summary of Image_"+num2str(iFrame, '%05i');
mkdir (fullfile(selpath,'CroppedImages','Reports'));
print(pdfTitle, '-dpdf', '-fillpage','-r600');
summaryPath = fullfile(selpath,'CroppedImages','Reports');
movefile(pdfTitle +".pdf",summaryPath);
The problem occurs everytime the script passes the line with print.
  댓글 수: 1
Filip Fedorowicz
Filip Fedorowicz 2020년 10월 27일
Update: I was running the script in live editor, somehow this was the problem as exports normally in the .m format.

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

채택된 답변

Kiran Felix Robert
Kiran Felix Robert 2020년 11월 6일
Hi Filip,
This is a known issue, which may be fixed in a future release.
A Workaround is to use the annotations to generate a common title as shown in the code below,
f = figure;
subplot(2,2,1)
title('First Subplot')
subplot(2,2,2)
title('Second Subplot')
subplot(2,2,3)
title('Third Subplot')
subplot(2,2,4)
title('Fourth Subplot')
annotation('textbox', [0.45, 1.0, 0.2, 0], 'string', 'Title',"EdgeColor",'None',"FontSize",15)
print(f,'figure_mlx','-dpng','-opengl')
Kiran Felix Robert

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by