Conclusio/matlab-epsclean

Not working on Matlab 2017b?

i2000s opened this issue · 4 comments

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!

Since Matlab 2017b has fixed the patch line issue (see here), maybe we don't need your script anymore? :)

Update*:

  • pcolor, surf and some other plots are not working on 2017b for exporting clean eps files. I was optimistic too early.

Since I don't have access to Matlab 2017b I can only speculate. Matlab is redefining postscript operators in their files it would be enough if that changed, but maybe it is something else...

If you can provide me with some raw eps files where my tool messes up I can have a look at what is happening.

Hi @Conclusio , please find the eps files attached. In the matlab.zip ball, figure.eps is generated with the default saveas function of Matlab; figure1.eps is generated with -painters option using export_fig package; figure2.eps is generated with -opengl option using export_fig function. *_clean.eps files are the corresponding figures using your tool. I am sure the eps code is redefined in Matlab 2017b, so you will see that some color in figure_clean.eps got lost, and there is nothing inside of figure1_clean.eps and figure2_clean.eps. I hope you have an idea on what's going on.
Matlab.zip

The tool will be very helpful if it can handle surf, pcolor and other plots. I also attached an example of using saveas for a surf(peaks(100)); shading interp; figure in figure3.zip ball. As you can see, it's very messy. I haven't found any tools that can handle this type of figures well enough.

figure3.zip

Let me know if you need something else. Thanks.

Very helpful, thank you.

It seems that Matlab changed the file commands depending on how eps files are saved.

  • figure.eps works if "combineAreas" is false, otherwise it doesn't. Need to investigate further...
  • figure1.eps, figure2.eps have clearly different commands now, therefore empty files are created
  • figure3.eps still can be cleaned, but the results will not change much or might have wrong z-ordering. Those results are consistent with Matlab 2016b - so sadly it never worked correctly.

So overall, a lot of problems :( - fixing these would take some hours and even then I'm not certain I can create "clean" files.

I will keep you updated on any progress, but my schedule is quite full at the moment - so not in the near future.