print figure to pdf - each plotted line gets split into smaller segments, leaving small gaps between them
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Rebecca Krosnick
2016 年 1 月 22 日
When I changed the number of points to 100 it seems the curves are no longer broken up into segments. I do not see those gaps. I also do not see the overlapping black dashes on the flat part of the curve. I however do still see the overlapping dashes at the very curvy parts of the curve, but I think that is unavoidable.
I also tried running your code in MATLAB R2014b, and with 600 points the gaps have disappeared, so you might want to try R2014b if you have access.
2 件のコメント
Walter Roberson
2016 年 1 月 22 日
This is something that has changed a fair bit in R2014b, and has been tweaked since then.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Graphics Performance についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!