|
Calling Sequence
|
|
plotcommand(plotargs, colorscheme=colorlist)
plotcommand(plotargs, colorscheme=palette)
plotcommand(plotargs, colorscheme=[scheme, schemeargs])
|
|
Parameters
|
|
plotargs
|
-
|
arguments to a plotting command
|
colorlist
|
-
|
list of colors
|
palette
|
-
|
a ColorTools[Palette] object or a string that is a name of a KnownPalette. For a palette name given by a string, it can be preceded by one of both modifier words "reverse" or "shifted" (as described in GetPaletteColors)
|
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="Viridis");
|
|
|
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 two calling sequences, the colorscheme option takes a list of colors or a ColorTools[Palette] 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 final 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 value or of the , and 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 and 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.
|
|
|
Coloring by Coordinates
|
|
•
|
The "zcoloring" and "xyzcoloring" color schemes allow you to color by values or by , and 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.
|
|
|
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.
>
|
|
Color a surface with the "zgradient" scheme.
>
|
|
Color a plot using a function of , , and coordinates.
>
|
|
Color a plot by values using the "valuesplit" scheme.
>
|
|
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:
|
>
|
|
Here is an example using a palette name with modifiers for the colorscheme
>
|
|
|
|
Compatibility
|
|
•
|
The colorscheme option was introduced in Maple 18.
|
•
|
The colorscheme option was updated in Maple 2016.
|
•
|
The palette parameter was introduced in Maple 2022.
|
•
|
The palette parameter was updated in Maple 2023.
|
|
|
|