# Improved dashed and dotted lines in EPS files

At the ICIP (International Conference on Image Processing) last week, a customer stopped by the MathWorks booth to chat. He said that he regularly uses one of the File Exchange submissions that "fixes" dashed and dotted lines in EPS files exported by MathWorks. so I spent some time looking into that issue this week.

I found that the new MATLAB graphics system introduced in R2014b has greatly improved the appearance of dashed and dotted lines in exported EPS files. Here's an illustration. (My test figure was inspired by the screen shot in the fix_lines submission on the File Exchange.)

widths = [0.5 1.0 2.0 5.0 10.0];
styles = {':','-.','--'};

[ii,jj] = meshgrid(1:length(widths),1:length(styles));

x = [0 1];
legend_strings = {};
hold on
for k = 1:numel(ii)
y = [k k];
style_k = styles{jj(k)};
width_k = widths(ii(k));
legend_strings{end+1} = sprintf('%s %.1f',style_k,width_k);
plot(x,y,'LineStyle',style_k,'LineWidth',width_k,...
'Color','k');
end
ylim([0, numel(ii)+1])
hold off
ax = gca;
set(ax,'YTick',1:numel(ii),...
'YTickLabel',legend_strings,...
'TickLength',[0 0],...
'XTick',[]);


Here is a 100 DPI rendering of the EPS output from R2014a:

I can understand why people wanted to "fix" that.

Here is a rendering of the EPS output from R2015b. (It looks like this for releases R2014b or later.)

That's much better.

So if you have been using a File Exchange submission such as "Fix dashed and dotted lines in EPS export" or fix_lines, you might want to check out R2014b or later.

Published with MATLAB® R2015b

|