whitebg

Change axes background color

whitebg is not recommended.

Syntax

whitebg
whitebg(fig)
whitebg(c)
whitebg(fig,c)
whitebg(fig,c)
whitebg(fig)

Description

whitebg complements the colors in the current figure.

whitebg(fig) complements colors in all figures specified in the vector fig.

whitebg(c) and whitebg(fig,c) change the color of the axes, which are children of the figure, to the color specified by c. The value of c can be a color name or an RGB triplet. The possible color names are: 'red', 'green', 'blue', 'cyan', 'magenta', 'yellow', 'black', or 'white'. An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range [0,1]; for example, [0.4 0.6 0.7].

whitebg(fig,c) sets the default axes background color of the figures in the vector fig to the color specified by c. Other axes properties and the figure background color can change as well, so that graphs maintain adequate contrast.

whitebg(fig) complements the colors of the objects in the specified figures. This syntax is typically used to toggle between black and white axes background colors, and is where whitebg gets its name. Include the root window handle (0) in fig to affect the default properties for new windows or for clf reset.

Examples

Set the background color to blue-gray.

whitebg([0 .5 .6])

Set the background color to blue.

whitebg('blue')

Tips

whitebg works best in cases where all the axes in the figure have the same background color.

Without a figure specification, whitebg or whitebg(c) affects the current figure and the root's default properties so subsequent plots and new figures use the new colors.

whitebg changes the colors of the figure's children, with the exception of shaded surfaces. This ensures that all objects are visible against the new background color. whitebg sets the default properties on the root such that all subsequent figures use the new background color.

See Also

Introduced before R2006a