Why do I get a white figure background when exporting a figure with another background color?

41 views (last 30 days)
I have a figure with a black figure background and a black axes background. My axes and labels are white. When I export this figure (e.g. to emf format) the figure background is reset to white and so I cannot read the labels anymore. How can I avoid this behaviour?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 10 Jun 2013
This is an issue of setting the right preferences for exporting the figure in MATLAB 7.1 (R14SP3) when using other background colors than white.
There is a default setting 'w' (for white) in the figure menu under File > Export Setup > Rendering > Custom Color. When you remove the checkmark, the background color will not be reset.
Programmatically, this can be done using the property InvertHardCopy of the figure.
surf(peaks);
set(gcf,'Color',[0.2 0.2 0.2]);
set(gcf,'InvertHardCopy','Off');
print('-f1', '-r600', '-djpeg', 'peaksfig');
A detailed explanation about printing and exporting in the current release of MATLAB is given at the following link:
<http://www.mathworks.com/help/releases/R2012b/matlab/creating_plots/how-to-print-or-export.html>

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products


Release

R14SP1

Community Treasure Hunt

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

Start Hunting!