make matlab figures for black backgrounds
February 16th, 2009 by Lawrence David
i prefer to make all of my powerpoint and keynote slides with dark backgrounds and white text. i find these slides to be much more readable in a dark room; the problem with this setup though is that most figure-making software automatically draw dark lines. matlab falls into this category.
to make matlab automatically create figures amenable to black slides, i’ve hit upon the following handy trick. prepend the following code right before you save your figure:
set(0,’DefaultAxesColor’,'w’,…
‘DefaultAxesXColor’,'w’,…
‘DefaultAxesYColor’,'w’,…
‘DefaultAxesZColor’,'w’,…
‘DefaultTextColor’,'w’,…
‘DefaultLineColor’,'w’)
set(gcf,’Color’,'w’)
set(gca,’color’,'none’
voila! all your figure text and lines are now white!
Thanks for the tip.
However, on XP your code doesn’t copy and paste very well. Perhaps you’ve used a font that Windows does not have. But the ellipses and quotation marks come out as undefined in Matlab.
Otherwise great info on your site.
Hi! There is a simpler way to do this:
whitebg
This command toggles between white and black background color, and sets the text colors appropriately.