Giter Club home page Giter Club logo

matlab-epsclean's Introduction

Fixing Matlab Vector Graphics Output

Clean/Repair .eps PostScript vector graphic files created by Matlab R2016b and Matlab R2017a. (Not working with R2017b and later versions (yet)).

  • Paths are grouped together according to their properties
  • White line artifacts are fixed
  • Broken up polylines are connected back together if they share the same properties (good for post-processing in Illustrator/Inkscape/etc.)
  • Adjacent polygons of the same type are merged together (use parameter 'combineAreas')

Related

Example

Here is an example of what the .eps file looks before and after fixing it:

%%% Matlab Code
z = peaks;
contourf(z);
print(gcf,'-depsc','-painters','out.eps');
epsclean('out.eps'); % cleans and overwrites the input file

Before and After Layer count in Adobe Illustrator: 789 (before) vs. 30 (after)

Another Example

%%% Matlab Code
[X,Y,Z] = peaks(100);
[~,ch] = contourf(X,Y,Z);
ch.LineStyle = 'none';
ch.LevelStep = ch.LevelStep/10;
colormap('hot')
saveas(gcf, 'out.eps', 'epsc');
epsclean('out.eps'); % cleans and overwrites the input file

Before and After Layer count in Adobe Illustrator: 11,775 (before) vs. 76 (after)

Notes

  • If you experience Z-order problems (i.e. the overlappings of your graphics change) try using parameter 'groupSoft' = true.
%%% Matlab Code
epsclean('out.eps','groupSoft',true);
%%% Matlab Code
epsclean('out.eps','closeGaps',true);
  • Have a look at the tests/cleantest.m script for test cases and examples
  • Report any problems here at github with your examples (code or .eps file). I try my best to fix them

matlab-epsclean's People

Contributors

conclusio avatar raacampbell avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.