MATLAB Answers

Why is there a discrepancy between and screen and .eps versions of images generated with the painters renderer? (Mac OS10.11.6, Matlab 2013b)

2 views (last 30 days)
Rick
Rick on 18 Sep 2016
Commented: Rick on 23 Sep 2016
Hi,
Here is my problem.
  • I need to produce a transparent surface and save it to an eps file; this is a requirement of a publisher and no other file format will do.
  • When producing this figure I have to use the painters renderer because it is the only one that produces vector output.
  • I can’t use mesh or surf because the resulting surfaces will be opaque; if one changes the α of the surface then the opengl renderer is invoked and the resulting image is pixel based rather than vector based.
  • I can’t use Matlab 2014 or later because changes to the vector graphics rendering makes the output unusable.
  • I have a (not great but usable) workaround in Matlab 2013b that uses plot3 or scatter3. Figure A shows this solution as it appears on the screen and as it shows up in a jpeg file. This is what I want the figure to look like, but I want the output to be vectors so that the image will scale with the resolution of the output device.
  • Figure B shows what the figure looks like when saved as an eps file. This is not what appears on the screen so something about the writing routine is wrong, or there is some flag that I’m unaware of. (The same discrepancy occurs when I use export_fig.)
  • Note that even though the surface (smaller) symbols and the larger plot symbols were all generated with plot3, in the eps file the larger plot symbols properly occlude the smaller ones but not vice versa. This is the problem.
Can anybody tell me why this discrepancy between the screen version and eps version occurs?
Thanks very much,
Rick
Figure A. The image as it appears on the screen and when saved as a jpeg
Figure B. The image as it appears when saved to an eps file.

Answers (1)

Saurabh Gupta
Saurabh Gupta on 23 Sep 2016
Hello Rick,
It is possible that MATLAB switches to OpenGL or ZBuffer renderer while saving your figure as an EPS file. This happens when the RendererMode is 'auto' and MATLAB considers the figure to be “too complex” for a vectorized output.
Make sure that you set the RendererMode as 'manual' and the Renderer as ‘Painters’ before saving the figure to your EPS file.
  1 Comment
Rick
Rick on 23 Sep 2016
Hi Saurabh,
Thank you for thinking about this. The renderer is not the problem. I used set(f,'renderer','painters') and output is clearly vectors; i.e., correct eps format. The problem is the difference between what Matlab (correctly) produces on the screen and what it (incorrectly) saves in the eps file.
Thanks,
Rick

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!