Wrong pixel color when save figure as pdf using a different background color
조회 수: 16 (최근 30일)
이전 댓글 표시
When I function imshow to display an image and change the default color, everything is okay. However, when I save the figure to pdf format, the color of white pixel is not correct.
set(groot, 'DefaultFigureColor', 'blue');
set(groot, 'DefaultFigureInvertHardcopy', 'off');
p = phantom();
figure(1)
imshow(p)
saveas(gcf, 'phantom.pdf');
This is the result of Figure 1.

This is the result in file 'phantom.pdf'.

댓글 수: 1
N/A
2020년 7월 9일
I don't know if this helps you, but try export_fig . it served me well so far when I wanted to export things to pdf.
채택된 답변
Sai Sri Pathuri
2020년 7월 15일
편집: Sai Sri Pathuri
님. 2020년 7월 16일
The cause is that renderer we use to print is switched to painters. You may use -opengl flag with print command
print(gcf, 'phantom', '-dpdf', '-opengl')
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Printing and Saving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!