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.
|Mandatory||List of arithmetical expressions|
|Objects||ColorData Default Values|
The internal reresentation of the
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.
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 := 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:
delete colordata, r: