Giter Site home page Giter Site logo

matlab-epsclean's People

Contributors

conclusio avatar raacampbell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

matlab-epsclean's Issues

Possible incompatibility with 2016a

Hello, I tried your script with Matlab 2016a and it doesn't seem to work, as it outputs something like this

bad_exp

Do you think it's really a version problem or might it be due to something else?

example where epsclean leaves a few white lines

This project is a great service to the community. Thanks! I am attaching an example where epsclean removes most, but not all of the artifacts. The original file is fig1.eps and the cleaned version is fig1c.eps (attached inside a zip-file). I have also attached the pdfs (created by Preview on a mac). I tried the four different combinations of true/false for the optional epsclean arguments and they all showed the same behavior. Thanks for your help. -Matt

fig1.pdf
fig1c.pdf
fig1.zip

newline if statement causes an error on R2016b

Your code works really well at cleaning up a very problematic EPS file I have. Thanks!

I noticed that the if statement on line 60 is a bug in R2016b. It leads to "Undefined function or variable 'newline'." This is because your newline variable doesn't get defined in R2016b but still shadows the MATLAB built-in.

I think the most direct solution might be to replace lines 161, 165, and 174 with sprintf statements. i.e.

currentBlockPrefix = sprintf('%s%s\n', currentBlockPrefix ,line);

This has the benefit of not raisng the <AGROW> warning, so you can even ditch those mlint decorators.

I'd also suggest you don't use line as a variable name because that shadows another built-in.

Issue with black backgrounds

Looks like the script does not respect the InvertHardCopy option set(gcf,'InvertHardCopy','off') which allows one to save figures with black backgrounds. All my figures with black backgrounds revert to white backgrounds after running this script.

Missing certain plots from graphics while using epsclean

Some of the labels and markers information from the figures is lost after using epsclean.m . Ex: text box, markers etc. I am using Matlab version 2017a. Can you please help. The below images illustrate the issue. Figure on the top is epsclean output, whereas the second one is expected output.
epsclean_output
expctedoutput

Undefined function or variable 'newline'.

When I run this in MATLAB R2015b, I get the following error:

epsclean('out.eps')
Undefined function or variable 'newline'.

Error in epsclean (line 169)
currentBlockPrefix = [currentBlockPrefix line newline]; %#ok

The "newline" element appears quite often in the code, and I am unsure of why it doesn't work in my version. It seems like this should be the equivalent of '\n' in the concatenated string, and so sprintf('\n') should produce the correct string char's on linux/windows/mac (since they all convert \n to different chars). I branched a local copy of the repo into a "fix_newline" branch and just submitted a pull request.

Not working on Matlab 2017b?

I installed Matlab 2017b, and found the script will remove some colored areas. For example,

Code:

contourf(peaks(100));saveas(gcf,'figure.eps','epsc')
epsclean('figure.eps','figure_clean.eps','GroupSoft',true,'combineAreas',true,'removeboxes',true)

Generates the following (I converted from eps to pdf for this preview):

figure_clean.pdf

figure.pdf

Do you have any idea? Thank you for making this tool, regardless!

Z-Order changes

By grouping elements according to their properties the z-order might change.

An example would be: A blue area which both covers and is covered by yellow areas. When grouping them according to their color, all blue parts are either in front or back of the yellow areas.

This needs a complete rethinking in the code, since dependencies between 'blocks' need to be introduced...

Apparent bug

Nice work, such a useful script! I kept getting the following error with my eps files,

Error using containers.Map/subsasgn
Specified key type does not match the type expected for this
container.

Error in epsclean>getBlockData (line 377)
        blockMap(blockId) = s; %#ok<NASGU>

Error in epsclean (line 203)
            [cbNewBlock,cbConn] =
            getBlockData(blockMap,cbPrefix);

I did a little hunting and found that blockId was occassionally set to [], so I added the following check to the functions writeBlocks and getBlockdata

if isempty(blockId)
  blockId='';
end

Everything seems to work now. Tested with MATLAB 2016a and 2017a.

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.