print figure to pdf - each plotted line gets split into smaller segments, leaving small gaps between them
이전 댓글 표시
Consider the following simple code:
clf
hold on
x = linspace(0,3*pi,600);
plot(x,sin(x),'k--','LineWidth',20)
plot(x,cos(x),'r-','LineWidth',20)
ylim([-1.2,1.2])
print('-dpdf','-r800','TestFig.pdf')
In the file 'TestFig.pdf' (highlighted by blue circles in attached image), it appears that the red and black line plots have been broken into smaller segments. You can see this e.g. at the top of the red peak (around x=2*pi), where there is a small white gap. You can also see this at various points along the dashed line (e.g. around x=pi); where one line segment stops and the next starts, the dash pattern is broken.
The number of data points in each line is 600. It appears this is being split up into line segments roughly 100 data points in length each. I wonder whether the print function is intentionally splitting the lines into smaller segments, and if so whether there is some way of stopping this happening so that each line is one uninterrupted vector object. Currently I am having to do this manually in Inkscape afterwards (where each segment is a different vector graphic object).
The choice of linewidth (20) and resolution ('-r800') is to exaggerate the effect. The problem still appears for other linewidths and resolutions. It also appears when printing to other vector graphic formats (e.g. .eps), although not for bitmaps (e.g. .png).
I've checked this on Matlab 2012 and 2014, on Ubuntu, Windows and OSX, all of which give the same behaviour.

채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Desktop에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!