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.

LineColor, LineColor2

Color of lines

Value Summary

LineColor, LineColor2InheritedColor

Graphics Primitives


LineColor sets the color of line objects such as 2D function graphs, curves in 2D and 3D, parameter lines on surfaces etc.

LineColor2 is a secondary color used for color blends.

LineColor determines the RGB color of line objects. The RGB library provides many pre-defined colors such as RGB::Red etc. See the section Colors of this document for more information on colors.

For pure line objects such as lines, curves, arrows, 2D function graphs etc., the line color can also be set by the attribute Color.

For surface objects such as 3D function graphs, surfaces etc., however, the attribute Color sets the FillColor. If you wish to change the color of the parameter lines on a surface, you have to use LineColor.

The RGB color set by LineColor cannot be animated. However, setting LineColorType = Functional, you can define a LineColorFunction that overrides the color set by LineColor. The line color function accepts an animation parameter, thus allowing to implement animated coloring of lines. See the help page of LineColorFunction for further details.

When the attribute LineColorType is set to one of the values Dichromatic or Rainbow, many line objects react to a secondary color set by the attribute LineColor2.

A gradient between the colors defined by LineColor and LineColor2 is created.

The color of the coordinate axes is set by the attribute AxesLineColor.


Example 1

We draw arrows of different colors:

plot(plot::Arrow2d([0, 0], [1, 2], LineColor = RGB::Red),
     plot::Arrow2d([0, 0], [1, 1], LineColor = RGB::Green),
     plot::Arrow2d([0, 0], [2, 1], LineColor = RGB::Blue)):

Example 2

We draw a parabola with a gradient between green and blue:

plot(plot::Function2d(x^2, x = 1..10, 
                      LineColorType = Dichromatic, 
                      LineColor = RGB::Green, 
                      LineColor2 = RGB::Blue)):

Example 3

As with any attribute, the line color can be read and changed using the ::-notation:

p := plot::Line2d([1, 2], [4, 5]):
p::LineColor := RGB::Blue


delete p:

Example 4

For surface objects such as 3D function graphs, LineColor sets the color of the parameter lines on the surface. Here, a semi-transparent RGBa color is chosen that gives only a faint indication of these lines:

plot(plot::Function3d(x^2 + y^2, x = -1..1, y = -1 ..1,
                      LineColor = RGB::Green.[0.25])):

Was this topic helpful?