|
Calling Sequence
|
|
plotcommand(plotargs, colorscheme=["zcoloring", zp, opts])
plotcommand(plotargs, colorscheme=["xyzcoloring", xyzp, opts])
|
|
Parameters
|
|
plotargs
|
-
|
arguments to a plotting command
|
zp
|
-
|
procedure or list of procedures, all having one input parameter
|
xyzp
|
-
|
procedure or list of procedures, all having three input parameters, or procedure with four input parameters
|
opts
|
-
|
(optional) optional arguments as described in the following Options section.
|
|
|
|
|
Summary
|
|
•
|
Use the colorscheme option to color a plot with functions of the coordinate values
|
>
|
plot3d(sin(x)*cos(y), x=0..2*Pi, y=0..2*Pi, colorscheme=["zcoloring", z->z^2]);
|
|
|
Introduction
|
|
•
|
This page describes how to color a plot element using functions of its , and coordinate values. This is done with the "zcoloring" and "xyzcoloring" schemes of the colorscheme option, which is available for most plotting commands.
|
•
|
The function values, computed through procedures, can represent RGB or hue values, or values from any other color space described on the ColorTools/ColorSpaces help page.
|
•
|
For general information about the colorscheme option and a list of other color schemes available, see the plot/colorscheme help page.
|
|
|
Hue Coloring
|
|
•
|
Plots can be colored with hue values ranging from 0 to 1. If the values given through the zp or xyzp procedures fall outside this range, they will be normalized so that the minimum value is 0 and the maximum is 1.
|
•
|
The first calling sequence, which invokes the "zcoloring" scheme, is used when the color is a function of only. In this case, zp must be a procedure having one input parameter (the coordinate value) and returning a single numeric value (the hue value).
|
•
|
The second calling sequence, which invokes the "xyzcoloring" scheme, is used when the color is a function of , and values. In this case, xyzp must be a procedure having three input parameters (the , and coordinate values) and returning a single numeric value (the hue value).
|
|
|
Colormap Coloring
|
|
•
|
Use the Plots can be colored using a palette as a colormap with values ranging from 0 to 1. This uses the same calling sequences as Hue Coloring described above with the addition of the palette=P option where P is a palette name or object which is passed to ColorTools:-Blend to compute the colors of the colormap.
|
|
|
RGB Coloring
|
|
•
|
RGB values can be computed with three separate procedures.
|
•
|
The first calling sequence, which invokes the "zcoloring" scheme, is used when the color is a function of only. In this case, zp must be a list of 3 procedures, each having one input parameter (the coordinate value) and returning a single numeric value (the R, G or B component).
|
•
|
The second calling sequence, which invokes the "xyzcoloring" scheme, is used when the color is a function of , and values. In this case, xyzp must be a list of three procedures, each having three input parameters (the , and coordinate values) and returning a single numeric value (the R, G or B component).
|
•
|
The second calling sequence also allows you to provide a single procedure with four input parameters. The first three hold the , and values. The fourth is a 3-element Vector or Array A. The procedure computes the R, G and B values for given values of , and and returns these values through A.
|
|
|
Using Other Color Spaces
|
|
•
|
Instead of RGB coloring, you can provide color values in any of the color spaces described on the ColorTools/ColorSpaces help page, using the colorspace option.
|
•
|
The second calling sequence is used in the same way as described for RGB coloring, for any of the 3-component color spaces. For a color space with components, such as CMYK, which has 4 components, the list of 3 procedures should be replaced by a list of procedures.
|
•
|
If a single 4-argument procedure is being used, then the Vector or Array A must contain elements, to match the number of components required for the alternate color space.
|
|
|
Options
|
|
|
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.
|
|
A string, the name of a ColorTools:-Palette to be used as a colormap in place of a HUE coloring.
|
|
|
Examples
|
|
Hue coloring by value:
>
|
|
>
|
|
RGB coloring by value:
>
|
|
Coloring by value, using the HSV color space:
>
|
|
Coloring by value, using the CMYK color space:
>
|
|
Hue coloring by , and values:
>
|
|
RGB coloring by , and values:
>
|
|
Using a single procedure with 4 parameters for RGB coloring:
>
|
f := proc(x, y, z, A)
A[1] := 0.0;
A[2] := 0.0;
A[3] := 0.0;
if x<1.0*Pi then
A[1] := 1.0;
end if;
if y<0.5*Pi or y>1.5*Pi then
A[2] := 1.0;
end if;
if abs(z)>=0.5 then
A[3] := 1.0;
end if;
end proc:
|
>
|
|
|
|
Compatibility
|
|
•
|
The colorscheme/coordinates option was introduced in Maple 2016.
|
•
|
The palette option was introduced in Maple 2024.
|
|
|
|