Uncategorized

How to change the default background color for Matlab figure?

One of the signatures of Matlab is the grayish background color it uses for its figures unless it is changed intentionally. In conference presentations or posters, one can easily detect Matlab outputs thanks to this color. For those who want to change this color right from the startup can do so by editing the default settings of Matlab. To access the default settings, type get(0,’Default’) in the Matlab command line. Then, it will display all the default settings. This is how my settings are:

get(0,'Default')

ans =

defaultFigurePosition: [680 678 560 420]
defaultTextColor: [0 0 0]
defaultAxesXColor: [0 0 0]
defaultAxesYColor: [0 0 0]
defaultAxesZColor: [0 0 0]
defaultPatchFaceColor: [0 0 0]
defaultPatchEdgeColor: [0 0 0]
defaultLineColor: [0 0 0]
defaultFigureInvertHardcopy: 'on'
defaultFigureColor: [0.8000 0.8000 0.8000]
defaultAxesColor: [1 1 1]
defaultAxesColorOrder: [7x3 double]
defaultFigureColormap: [64x3 double]
defaultSurfaceEdgeColor: [0 0 0]

For our particular target of changing the default figure background, one can simply change the defaultFigureColor attribute to any desired color, e.g. to white, as follows:

set(0,'defaultFigureColor',[1 1 1])

Similarly, to black as follows:

set(0,‘defaultFigureColor’,[0 0 0])

And here is how the outputs look when any figure is opened after the change in the default setting.

With default background color
Modified background color: White

Modified background color: Black

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s