Jagged outline using Matlab 2014b

后端 未结 2 1074
星月不相逢
星月不相逢 2020-12-21 08:57

I am plotting some maps using Matlab that use mapshow to plot the country border from a shapefile. I then export them to both a PDF and EPS format using the

相关标签:
2条回答
  • 2020-12-21 09:08

    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.

    0 讨论(0)
  • 2020-12-21 09:18

    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);
    
    0 讨论(0)
提交回复
热议问题