Problem with the latex eps format
조회 수: 10 (최근 30일)
이전 댓글 표시
Hello friends, I would like you to help me, I am using the 2020 trial version of matlab, I want to make a report in latex but when importing the graphics in .eps format in the latex document they come out pixelated. I would like you to give me some help since when I used matlab 2016 the graphs turned out well.
matlab codeph:
num=[1 5 -5 0 19]
den=[1 5 1 1 1 -4]
f=tf(num,den)
rlocus(f)
댓글 수: 1
Vladimir Sovkov
2020년 10월 4일
It is strange but you are right indeed. In the matlab window, the curves look to be vectorized, but after exporting to eps or svg they become pixelated. It never happened when I created plots with the plot command, etc. On the other hand, eps files are allowed to contain bitmap images, and you can insert them into the latex document anyway. I have no idea what else can be done.
채택된 답변
Bjorn Gustavsson
2020년 10월 4일
When you write to postscript-format matlab (still) makes "clever" choises about how to write the file. Try to enforce vectorized format by invoking the painters renderer:
print -depsc2 -painters Your_file-01.eps
or:
print('-depsc2','-painters','Your_file-01.eps')
Otherwise print might use the -opengl renderer.
HTH
댓글 수: 4
Bjorn Gustavsson
2020년 10월 7일
You have to do some work, I'm afraid. In my long-work-scripts I typically have snippets something like this:
%At the top of the script I have define directives-variables
print_figs = 1; % or zero to not plot figures, or even an array of ones and zeros...
% Then I typically have a run-index saved in a project-specific mat-file:
load('thisproject.mat',run_idx)
run_idx = run_idx + 1; % that I increment
save('thisproject.mat','run_idx','-append')
% Then in the script for each figure I have:
if print_figs
print('-depsc2','-painters',sprintf('Figures/this-fig-name-%03d.eps',run_idx))
end
That becomes a simple process of copy and paste when modifying, so not that bothersome.
You could write yourself a function that does something similar, perhaps something like this:
function thatwentok = print_another_eps_figure()
load('fignumber.mat',idx)
idx = idx+1;
save('fignumber.mat','idx')
print('-depsc2','-painters',sprintf('next-fig-%04d.eps',idx))
end
Then you'd only have to run that function and the figures will be saves with incremental names. But this convenience, I think, will not benefit you that much in the long run because one thing you will want to do is to re-do your figures, and that is very much helped by having scripts/functions that you can run and reproducibly repeat the tasks. But, maybe it is worth it.
추가 답변 (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!