ColorData

Color values of a raster plot

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Value Summary

MandatoryList of arithmetical expressions

Graphics Primitives

ObjectsColorData Default Values
plot::Raster 

Description

ColorData is a nested list of RGB color values visualized by a plot::Raster object.

The internal reresentation of the ColorData entry of a plot::Raster object is a list of lists of color values. Also a matrix or a 2-dimensional array of color values can be assigned to this entry: they are converted to a list of lists.

Examples

Example 1

We create a raster plot object:

colordata := [[RGB::Red,   RGB::Green, RGB::Blue ],
              [RGB::Black, RGB::Cyan,  RGB::White]]:
r := plot::Raster(colordata, x = 0..3, y = 0..2):
plot(r):

The color data of the raster object can be accessed via the ColorData slot:

colordata := r::ColorData

The list of list of color values is turned into an array. After changing one entry, the new colors are written back into the raster object:

colordata := array(1..2, 1..3, colordata):
colordata[2, 3] := RGB::Magenta:
colordata

r::ColorData := colordata:
plot(r)

Although the color values were assigned as an array, they are internally stored as a list of lists:

r::ColorData

delete colordata, r: