MATLAB: edges of patches visible after export as vector graphics

Patches in Matlab are glued from separate triangles. Their edges are usually not visible, but when I export the figure to a vector graphic format, they can be clearly visible (the whole picture is not displayed, just an enlarged part)

edges of individual triangles

The code to create 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') 

The alternative fill function behaves the same. Is there a way to avoid this error or do I need to live with bitmaps in this case?

EDIT: One workaround is to cut out the area instead of filling it. This is obviously not always possible, but in my case it worked beautifully, and I could stick with vector graphics. Corresponding FEX submission http://www.mathworks.com/matlabcentral/fileexchange/30733-hatchfill

+7
matlab vector-graphics matlab-hg2
source share
2 answers

plot2svg allows you to create vector image files (SVG) with inextricable patches. I would follow export_fig updates, it seems that Yair Altman is working on this problem . Wouldn’t hold my breath for a solution from The Mathworks.

0
source share

The scattered output of vector graphics (fragments, triangles, rectangles instead of shared objects) is one of the secret functions after updating the R2014b graphics engine.

I managed to join these triangles along with the following python script that uses the Inkscape system call https://github.com/Sbte/fix_matlab_eps . But this is a workaround that works for simple stories. This is not a solution.

Use either bitmap output or save your data and use matplot software for python.

0
source share

All Articles