Why do 3D plots become pixelated after exporting to SVG, while 2D plots do not?

조회 수: 10 (최근 30일)
Bruce
Bruce 2025년 1월 20일
댓글: Bruce 2025년 2월 3일
I created a 2D and a 3D plot using the attached code and saved them in SVG format. I then inserted both into a LaTeX document using the same command. However, in the resulting PDF, it looks like only the 2D plot is vector based (as intended), while the 3D plot appears to be pixelated. Can anyone tell me why?

답변 (1개)

Divyanshu
Divyanshu 2025년 1월 21일
Hello @Bruce,
A possible cause for the issue can be MATLAB switiching the auto-renderer setting to '-opengl' to render the plot. This generally happens when the number of elements exceed a certain threshold in the figure.
The workaround is to manually force the '-vector' renderer, this should give correct graphics output. You can try adding the following command to the script and observe the results:
print(hfig,'-vector','-dpdf',[fname,'.pdf'])
You can read about this property in this documentation link.
  댓글 수: 1
Bruce
Bruce 2025년 2월 3일
Thanks for the answer and sorry for the delayed response, but I was on vacation. I have implemented the code you suggested, but it looks like nothing has changed in the figure. I think I will have to read the documentation link you provided when I have time. I may come back to this question later.

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

카테고리

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

태그

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by