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'?

C
Christian · Aug 7, 2020 · 2.2K views
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'?   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 PhD Expert
Answered Aug 17, 2026

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.

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!