This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Change axes background color

whitebg is not recommended.


whitebg(fig, ColorSpec)
whitebg(fig, ColorSpec)


whitebg complements the colors in the current figure.

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

whitebg(ColorSpec) and whitebg(fig, ColorSpec) change the color of the axes, which are children of the figure, to the color specified by ColorSpec. Without a figure specification, whitebg or whitebg(ColorSpec) affects the current figure and the root's default properties so subsequent plots and new figures use the new colors.

whitebg(fig, ColorSpec) sets the default axes background color of the figures in the vector fig to the color specified by ColorSpec. Other axes properties and the figure background color can change as well so that graphs maintain adequate contrast. ColorSpec can be a 1-by-3 RGB color or a color name such as 'white' or 'w'.

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.


Set the background color to blue-gray.

whitebg([0 .5 .6])

Set the background color to blue.



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

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.

Introduced before R2006a

Was this topic helpful?