Why does my .eps file look different from the MATLAB figure on the screen, when I have the 'EraseMode' property of a patch object set to 'xor'?

Illustration
Christian - 2020-08-07T10:20:18+00:00
Question: Why does my .eps file look different from the MATLAB figure on the screen, when I have the 'EraseMode' property of a patch object set to 'xor'?

Why does my .eps file look different from the MATLAB figure on the screen, when I have the 'EraseMode' property of a patch object set to 'xor'?   The .eps file generated from the following code looks different from the figure on the screen:   p1=patch([4 6 6 4],[4 4 6 6],'k'); set(p1,'FaceColor',[0.85 0.85 0.85],'EdgeColor', [1 1 1]); set(p1,'EraseMode','xor'); hold on; plot([1:10],[1:10],'k') print -deps temp I have tried using different renderers. The result is same with all the 3 renderers.

Expert Answer

Profile picture of Neeta Dsouza Neeta Dsouza answered . 2025-11-20

When the 'EraseMode' property of a patch object is set to 'xor' in MATLAB, the .eps file may look different from the figure on the screen due to a bug in how .eps files are generated. The 'xor' mode performs a bitwise XOR operation on the patch colors and the background, which can result in unexpected colors and artifacts.

Workaround: To avoid this issue, set the 'EraseMode' property to 'normal' before saving the figure as an .eps file.


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!