Some figures not saving as vector graphics (.svg)

조회 수: 262 (최근 30일)
Paul
Paul 2017년 10월 28일
편집: Walter Roberson 2023년 11월 20일
Hi,
I ran into a strange problem. I'm trying to save figures in vector format to process in Adobe Illustrator. I make numerous of these plots using one script and in many cases the output to vector graphics using the .svg format works fine. Some figures, made by the same script and apart from the specific datapoints indistinguishable from other figures, do not export as proper vector graphics. In those cases I can open the output .svg file in Illustrator but the image is basically flat; i.e. I can not isolate individual elements for editing.
I have attached two figures extracted at the exact point in the script where the data is added that causes it to not save properly. I plot datapoints on a trial-trial basis, adding data from one trial, then the data from the next trial etc. Until a particular trial I can save the figure as a proper vector graphic .svg file (attached as Fig1Vector.fig). When data from the next trial is added, the output .svg file only contains a flattened image (attached as Fig2NotVector.fig).
I've been looking for differences between the two figures but I have exhausted my ideas on what could be at cause. Do any of you have any idea what could be going wrong here or any suggestions to do a successful vector image export?
Thanks in advance.
Best, Paul

채택된 답변

Paul
Paul 2017년 11월 1일
편집: Paul 2023년 9월 12일
I figured out what the problem was. After a certain maximum of elements in the picture, Matlab's auto-renderer setting switches from using the -painters renderer to the -opengl renderer. Manually forcing the -painters renderer restores proper vector graphics output.
[2023 update] See Martin's helpful reply to this answer for the syntax to trigger the correct behavior in different Matlab versions.
  댓글 수: 15
Paul
Paul 2023년 9월 12일
Thanks Martin! I have edited my answer to refer to your addition.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by