Patches in Matlab are glued together from individual triangles. Their edges are normally not visible, but when I export the figure in a vector graphics format they can clearly be seen (not the whole picture is shown, just a zoomed-in portion)
Code to generate this MWE was:
xx = [0:1:100, 100:-1:0];
yy = [zeros(1,101), ones(1,101)];
p1 = patch(xx,yy,'b');
print('testPatch','-dpdf','-painters')
Alternative function fill
behaves the same. Is there a way to avoid this bug or do I have to live with bitmaps in this case?
EDIT: One workaround is to hatch the area instead of filling it. That obviously isn't always possible, but in my case it worked nicely and I could stick to vector graphics. The relevant FEX submission is http://www.mathworks.com/matlabcentral/fileexchange/30733-hatchfill
export_fig
from Matlab FEX. It does an amazing job exporting figures, way better than Maltab itself. try it out. – Copenhagenexport_fig test.pdf -painters
produces the same, patchy output. I've had my fair share of grief with Matlab's vector output, and I gave up on trying to convince Matlab to make beautiful figures. Instead, I save as eps, and then edit it in Illustrator or Inkscape to fix the fonts, linewidths, ... – FeelingGraphicsSmoothing
andRenderer
, setting them to'off'
and'painters'
respectively – Sonde