필터 지우기
필터 지우기

how to fix half saved image problem in pdf form

조회 수: 4 (최근 30일)
Rabih Sokhen
Rabih Sokhen 2023년 3월 1일
댓글: Rabih Sokhen 2023년 3월 1일
Hello guys.
I have a problem when I try to save matlab image as a pdf, only a part of the image is saved in the pdf format as we can see in the attached file.
Thank you in advance
the folowwing code is :
clear all
figure(1)
set(gcf, 'WindowState', 'maximized');
plot([-1 -1 1 1 -1],[-1 1 1 -1 -1],'k','LineWidth',5);
axis square
xlabel('x')
ylabel('y')
set(gca,'fontweight','bold','fontsize',30);
hold off
saveas(gcf,'myfigure.pdf')

채택된 답변

Luca Ferro
Luca Ferro 2023년 3월 1일
편집: Luca Ferro 2023년 3월 1일
i think it's working correctly. Be careful because with this line:
set(gcf, 'WindowState', 'maximized');
you specify that the plot will be saved as fullscreen so the .pdf image will represent that. Meaning that if you for example resize the plot window and consequently resize the axis their ticks will change.
In images:
this is the saved pdf (left) and the fullscreen plot (right) which are the same. so it is working correctly.
and this is the plot resized (draging the corners of the figure after generation), which is different just because of the figure scale

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by