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
plotcommand(plotargs, colorscheme=colorlist)
plotcommand(plotargs, colorscheme=palette)
plotcommand(plotargs, colorscheme=[scheme, schemeargs])
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
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 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 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, 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.
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.
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.
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.
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.
Color a set of points with the default "linear" scheme.
dataplot⁡seq⁡sin⁡i⁢π10,i=1..20,colorscheme=Orange,Blue,style=point,symbolsize=20
Color a surface with the "zgradient" scheme.
plot3d⁡sin⁡x⁢cos⁡y,x=0..π,y=0..π,colorscheme=zgradient,Red,Blue
Color a plot using a function of x, y, and z coordinates.
plot3d⁡sin⁡x⁢cos⁡y,x=0..2⁢π,y=0..2⁢π,colorscheme=xyzcoloring,x,y,z↦x+y−z2,style=surface
Color a plot by values using the "valuesplit" scheme.
dataplot⁡LinearAlgebra:-RandomMatrix⁡20,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:
plot3d⁡−2⁢x2−y2,x=−5..5,y=−5..5,colorscheme=p,0.8,0.5,grid=60,60,style=surface
Here is an example using a palette name with modifiers for the colorscheme
plot3d⁡−2⁢x2−y2,x=−5..5,y=−5..5,colorscheme=reverse shifted twilight,grid=60,60,style=surface
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.
The palette parameter was introduced in Maple 2022.
For more information on Maple 2022 changes, see Updates in Maple 2022.
The palette parameter was updated in Maple 2023.
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