Plot Color Schemes - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Graphics : 3-D : Options : colorscheme : plot/colorscheme

Plot Color Schemes

 

Calling Sequence

Parameters

Summary

The colorscheme Option

The Gradient Color Schemes

Coloring by Coordinates

Coloring by Values

Custom Color Schemes

Color Spaces

Examples

Compatibility

Calling Sequence

plotcommand(plotargs, colorscheme=colorlist)

plotcommand(plotargs, colorscheme=[scheme, schemeargs])

Parameters

plotargs

-

arguments to a plotting command

colorlist

-

list of colors

scheme

-

string or procedure; name of a color scheme or a procedure that produces a color structure

schemeargs

-

additional required arguments or keyword options for the given color scheme

Summary

• 

Use the colorscheme option to apply a color scheme to a plot.

plot3d(1, s=0..Pi, t=0..2*Pi, coords=spherical, colorscheme=["Teal", "Purple"]);

The colorscheme Option

• 

The colorscheme option allows you to apply a color scheme to a surface, curve, or set of points created by a plot command.

• 

Most but not all plotting commands support this option. You can also use the colorscheme option with the plots:-display command. In this case, an attempt is made to apply the color scheme to each element of the plots passed to the command.

• 

In the first calling sequence, the colorscheme option takes a list of colors and applies the "linear" or "zgradient" color scheme as described in the following section. The colors may be specified in any of the forms described on the plot/color help page.

• 

In the second calling sequence, scheme is the name of a predefined color scheme, such as "xgradient", or a custom procedure. The parameter schemeargs is a sequence of arguments that is passed to the procedure implementing the color scheme. This calling sequence must be used if you wish to add a suboption such as colorspace.

• 

The various color schemes available are listed here:

– 

The "linear", "xgradient", "ygradient" and "zgradient" color schemes allow you to apply a color gradient to the plot.

– 

The "zcoloring" and "xyzcoloring" schemes allow you to color using functions of the z value or of the x, y and z values.

– 

The "valuesplit" color scheme allows you to map a collection of colors to values associated with points in the plot.

– 

Procedures implementing custom color schemes can also be used.

• 

Note that, when using the plot3d command, coloring 3-D surfaces based on the x and y coordinates can also be done without the colorscheme option. See the plot3d/colorfunc help page for more information.

The Gradient Color Schemes

• 

The gradient color schemes, which include the "linear", "xgradient", "ygradient", and "zgradient" schemes, apply color gradients to plot elements. A list of colors, chosen from those described on the plot/color help page, is provided, along with optional arguments.

• 

When using the first calling sequence, the "linear" color scheme is the default scheme for curves and collections of points, and the "zgradient" color scheme is the default for surfaces.

• 

See plot/colorscheme/gradient for a full description of how to apply the gradient color schemes to plots.

Coloring by Coordinates

• 

The "zcoloring" and "xyzcoloring" color schemes allow you to color by z values or by x, y and z values.

• 

See plot/colorscheme/coordinates for a full description of how to color by coordinate values.

Coloring by Values

• 

The "valuesplit" color scheme allows you to partition the points by color according to associated values. For example, you can specify that all points with negative values be colored blue while all others be colored red. The values can be the plot data values themselves or they can be provided through an additional argument.

• 

See plot/colorscheme/valuesplit for a full description of how to use the "valuesplit" color scheme.

Custom Color Schemes

• 

You can use the second calling sequence to write a custom color scheme. This feature is recommended only for experienced Maple programmers familiar with the internal plot structure as described on the plot/structure help page.

• 

The argument scheme must be a procedure that accepts as its first argument any of the plot structures (for example, MESH, GRID, POINTS) to which you will apply the color scheme. It must return a valid COLOR data structure for that plot structure. It is important to ensure that the number of colors defined by the COLOR structure matches the number of colors needed by the plot structure.

• 

The remaining arguments in the sequence schemeargs are passed to procedure scheme. For example, if scheme requires a list of two colors and an integer, then these must be included in schemeargs when the colorscheme option is used. The procedure scheme can also be defined so it accepts keyword options. See the Argument Processing help page for more information.

Color Spaces

• 

By default, the RGB color space is used. You can use the colorspace=t option to specify a different color space. The value t must be a string and can be any of the color spaces listed on the ColorTools/ColorSpaces help page.

Examples

Color a set of points with the default "linear" scheme.

dataplotseqsiniπ10,i=1..20,colorscheme=Orange,Blue,style=point,symbolsize=20

Color a surface with the "zgradient" scheme.

plot3dsinxcosy,x=0..π,y=0..π,colorscheme=zgradient,Red,Blue

Color a plot using a function of x, y, and z coordinates.

plot3dsinxcosy,x=0..2π,y=0..2π,colorscheme=xyzcoloring,x,y,z→x+yz2,style=surface

Color a plot by values using the "valuesplit" scheme.

dataplotLinearAlgebra:-RandomMatrix20,surface,style=point,colorscheme=valuesplit,∞..1=Blue,0..∞=DarkRed,symbol=solidcircle,symbolsize=15

Define and use a custom color scheme.

p := proc(grd::specfunc(GRID), col)
    local A, C, dims, r, t;
    A := op(3, grd);
    r := max(A)-min(A);
    dims := rtable_dims(A);
    C := Array(dims, 1..3, (i,j,k)->`if`(k=1, A[i,j]/r,
        `if`(k=2, col[1], col[2])), 'datatype'='float[8]');
    return 'COLOR'('HSV', C);
end proc:

plot3d2x2y2,x=5..5,y=5..5,'colorscheme'=p,0.8,0.5,'grid'=60,60,'style'='surface'

Compatibility

• 

The colorscheme option was introduced in Maple 18.

• 

For more information on Maple 18 changes, see Updates in Maple 18.

• 

The colorscheme option was updated in Maple 2016.

See Also

Argument Processing

ColorTools/ColorSpaces

plot/color

plot/colorscheme/coordinates

plot/colorscheme/gradient

plot/colorscheme/valuesplit

plot/structure

plot3d

plot3d/colorfunc

plots:-densityplot

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam