altmany / export_fig

A MATLAB toolbox for exporting publication quality figures
BSD 3-Clause "New" or "Revised" License
1.28k stars 368 forks source link

Forcing painters renderer breaks images #262

Open durack1 opened 6 years ago

durack1 commented 6 years ago

I pulled the latest version (26eb699) of export_fig yesterday, so this should be directly reproducible.

This issue replicates #107 (superscripts in figure axes), but also goes further than this as the output from the -opengl vs -painters renderer option yields very different (and incorrect) output. This can be most easily described with examples.

So I generate a figure which looks fine on the screen, and using -opengl or -painters I get the following, for completeness the command is (with either renderer specified):

export_fig([out_dir,datestr(now,'yymmdd'),'_Fig',fignum],'-eps','-opengl')

So the OPENGL output looks like 181128_fig1-opengl And the PAINTERS output looks broken, with the fill seeming to be mixed across layers, like 181128_fig1-painters

A similar issue also occurs with another figure, so

OPENGL 181128_fig5-opengl PAINTERS with text missing along with lines that should be bolded not in the Pacific and Indian oceans 181128_fig5-painters

Is this an export_fig issue, or matlab?

For completeness:

MATLAB Version: 9.5.0.944444 (R2018b)
Operating System: Linux 2.6.32-754.3.5.el6.x86_64 #1 SMP Thu Aug 9 11:56:22 EDT 2018 x86_64
Java Version: Java 1.8.0_152-b16 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Export_fig Version: current master (26eb699)
altmany commented 6 years ago

I believe that the problem is due to internal bug(s) in Matlab's builtin print function (which is used by export_fig). In order to verify this, please run the following command and check whether you see the same problems in the resulting test.eps file:

print(gcf, '-loose', '-opengl', '-r864', '-depsc2', 'test.eps')

If you see the same problems, then you should report these to Mathworks (support@mathworks.com). If you do NOT see the problems, then this means it's a problem in export_fig - in this case I may be able to fix it.

Let me know what happens.

durack1 commented 6 years ago

@altmany thanks for that, so I did run this through using the command above (with a tweak to the filename) and got this: 181130_fig1-test

So it does indeed appear to be an issue with export_fig

durack1 commented 6 years ago

@altmany and for completeness, this is the second figure which also checks out fine.. I do note the file size has jumped considerably though from 6.8 to 25.5Mb. 181130_fig5-test

altmany commented 6 years ago

Email me the *.fig file for the figure with the charts and I will investigate - altmany (at) gmail

durack1 commented 5 years ago

@altmany thanks for this, I have sent these through via email. Happy holidays!

altmany commented 5 years ago

@durack1 - I ran your figures through Matlab's builtin print command and the resulting EPS files show the same problems as the ones that you reported:

print(gcf, '-loose', '-opengl',   '-r864', '-depsc2', 'test-opengl.eps')    % ok
print(gcf, '-loose', '-painters', '-r864', '-depsc2', 'test-painters.eps')  % not ok

This proves that it's a problem with Matlab's builtin print command, and not with export_fig. I suggest that you report this to Mathworks (support@mathworks.com).