Line coloring types

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

InheritedDichromatic, Flat, Functional, Monochrome, or Rainbow


LineColorType controls the type of line coloring used. With the exception of Flat and Functional, the coloring schemes depend on the height, i.e., the z or y value (in 2D or 3D, respectively) of points on the line, relative to the extension of the viewing box.

By default, lines are drawn in the color set by the attribute LineColor. This is caused by the setting LineColorType = Flat. The other possible values for LineColorType mean:

  • Dichromatic

    The color of a point on a line depends on its height, with the lowest point using LineColor2, the highest one using LineColor, and all other points using a linear interpolation in RGB color space.

  • Flat

    The line is drawn with LineColor. No blend is used.

  • Monochrome

    The line is drawn with a blend from LineColor to a dimmed version of LineColor.

  • Rainbow

    This setting is technically similar to Dichromatic, but the effect is vastly different, since interpolation takes place in HSV color space. This creates a “rainbow effect”, which mostly conforms with a physical rainbow for suitable choices of colors.

  • Functional

    Both LineColor and LineColor2 are ignored; the color scheme is derived from LineColorFunction. See ?LineColorFunction for details (which depend on the object type). If no color function is given, the object will be rendered with LineColorType = Flat.


Example 1

By default, lines are drawn in one flat color:


plot(plot::Polygon2d([[-1,-1], [1,-1], [1,1], [-1,1]],
                     Closed = TRUE, Filled = FALSE))

Example 2

Using LineColorType = Dichromatic, Monochrome, or Rainbow causes a height-dependent color effect:

plotfunc2d(sin(x), LineColorType = Rainbow)

Note that height coloring depends on the height of the whole scene, not only on that of individual objects:

 plot::Function2d(sin(x) + 0.2, LineColorType = Dichromatic),
 plot::Function2d(sin(x) + 0.0, LineColorType = Monochrome),
 plot::Function2d(sin(x) - 0.2, LineColorType = Rainbow),
 LineColor = RGB::Red, LineColor2 = RGB::Blue