Jagged outline using Matlab 2014b

二次信任 提交于 2019-11-29 14:59:57

Matlab acknowledged that this is known bug. For me the first fix worked.

The issue of jagged lines on the figures while exporting in the vector format is a known bug in MATLAB R2014b. It is associated with the combination of linejoins and meterlimits used in vector format.

To work around this issue, use the attached function fixeps to post process the EPS file. You can use one of the following ways to call this fixeps function.

fixeps('input.eps','output.eps','LJ') % Will change the linejoins to round

fixeps('input.eps','output.eps','ML') % Will correct the miterlimit

function fixeps(inname,outname,fixmode)
if nargin==2
    fixmode = 'LJ';
end
fi = fopen(inname,'r');
fo = fopen(outname,'w');
tline = fgets(fi);
while ischar(tline)
    if (strcmp(tline,['10.0 ML' 10])) % Replace 10.0 miterlimit
        switch (fixmode)
            case 'LJ'
                fwrite(fo,['1 LJ' 10]); % With round linejoin
            case 'ML'
                fwrite(fo,['2.5 ML' 10]); % With smaller miterlimit
        end
    else
        fwrite(fo,tline);
    end
    tline = fgets(fi);
end
fclose(fo);
fclose(fi);

I had a similar problem that I found to be caused by the 'MarkerSize' option. It seems that in version 2014b it inherits the units of the figure. For example, if I have a figure in centimeters and I ask for ('MarkerSize', 10), the 10 will not be interpreted as points (as in 2014a) but as cm. I fixed this by changing the figure units to pt.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!