Documentation Center

  • Trial Software
  • Product Updates

Colors Controlled by Axes


Axes properties specify the color of the axis lines, tick marks, labels, and the background. Properties also control the colors of the lines drawn by plotting routines and how image, patch, and surface objects obtain colors from the figure colormap.

The axes properties discussed in this section are listed in the following table.


Characteristic it Controls


Axes background color

XColor, YColor, ZColor

Color of the axis lines, tick marks, gridlines, and labels


Title text object handles

XLabel, YLabel, Zlabel

Axis label text object handles


Controls mapping of graphic object CData to the figure colormap


Automatic or manual control of CLim property


Line color autocycle order


Line styles autocycle order (not a color, but related to ColorOrder)

Specifying Axes Colors

The default axes background color is set up by the colordef command, which is called in your startup file. However, you can easily define your own color scheme.

Changing the Color Scheme

Suppose you want an axes to use a "black-on-white" color scheme. First, change the background to white and the axis lines, grid, tick marks, and tick mark labels to black.


Next, change the color of the text objects used for the title and axis labels.


Changing the figure background color to white completes the new color scheme.


When you are done, a figure containing a mesh plot looks like the following figure.

You can define default values for the appropriate properties and put these definitions in your startup.m file. Titles and axis labels are text objects, so you must set a default color for all text objects, which is a good idea anyway because the default text color of white is not visible on the white background. Lines created with the low-level line function (but not the plotting routines) also have a default color of white, so you should change the default line color as well.

To set default values on the root level, use


The MATLAB® software colors other axes children (i.e., image, patch, and surface objects) according to the values of their CData properties and the figure colormap.

Was this topic helpful?