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.


List of colors to use

For colors in MATLAB®, see colorspec.

Value Summary

OptionalList of colors


Colors sets a list of colors to use for object parts.

Plot objects like plot::Piechart3d or plot::MuPADCube that use more than one color use Colors to have a configurable list of colors to use.

The length of the list in Colors need not be fixed, it just must not be empty. If the list contains more colors than needed, the remaining colors are simply not used; if the list contains fewer colors than needed, it will be used cyclically, i.e., as if it were repeated as often as necessary. Cf. Example 2.


Example 1

Most of the statistical plots use Colors for the colors of their groups:

plot(plot::Bars2d([[frandom() $i=1..2] $ i = 1..3]))

plot(plot::Bars2d([[frandom() $i=1..2] $ i = 1..3],
           Colors = [RGB::Orange, RGB::Yellow, RGB::Magenta]))

Example 2

If more colors are required than given in Colors, the given list is used cyclically:

plot(plot::Piechart2d([1, 1, 1, 1], Colors = [RGB::White, RGB::Blue]))

See Also

MuPAD Functions

Was this topic helpful?