Pick a color uniformly at random in RGB color space
MuPAD® notebooks are not recommended. 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.
RGB::random() returns a random color. The
colors returned are distributed independently and uniformly in the
RGB color space.
RGB::random can be used to produce high-frequency
plot(plot::Raster([[RGB::random() $ x = 0..42] $ y = 0..42]))
It is possible to use
as a color function, but the result may be unexpected:
plot(plot::Waterman(5, FillColorFunction = RGB::random))
The reason is that the color function will be called repeatedly if the same point is met again. It is a better idea to create a bunch of random colors and then use the parameters passed into the color functions to get some consistency into the choice of colors:
colors := [RGB::random() $ i = 1..42]: plot(plot::Waterman(5, FillColorFunction=((x,y,z,i) -> colors[i])))
RGB color: A list of three floating-point values.