ColorTools - Maple Programming Help

Home : Support : Online Help : Graphics : Packages : ColorTools : Color and Color Object Manipulation Commands : ColorTools/SortPalette

ColorTools

 SortPalette
 sort colors into a good palette order

 Calling Sequence SortPalette(colors) SortPalette(colors, opts)

Parameters

 colors - list of colors in formats recognized by ColorTools opts - optional arguments for the Distance computations

Description

 • The SortPalette command sorts a list of colors so that the earlier colors are as far apart as possible in the sense of the metric used by the Distance command.  In the resulting palette, the earlier colors will be more visually distinguishable, which can be useful when using the palettes for plotting.
 • The first color of the list colors will remain the first color.
 • Arguments other than the list of colors will be passed as options to the color Distance command.

Examples

 > $\mathrm{with}\left(\mathrm{ColorTools}\right):$
 > $\mathrm{origp}≔\left[{\mathrm{GetPalette}\left("HTML"\right)}_{[]}\right]:$
 > ${\mathrm{origp}}_{1..5}$
 $\left[{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}{,}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}{,}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}{,}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}{,}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}\right]$ (1)
 > $\mathrm{randp}≔{\mathrm{origp}}_{{\mathrm{combinat}}_{\mathrm{randperm}}\left(\left[\mathrm{}\left(1..\mathrm{nops}\left(\mathrm{origp}\right)\right)\right]\right)}:$
 > ${\mathrm{randp}}_{1..5}$
 $\left[{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}{,}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}{,}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}{,}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}{,}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}\right]$ (2)
 > $\mathrm{sortedp}≔\mathrm{SortPalette}\left(\mathrm{randp}\right):$
 > ${\mathrm{sortedp}}_{1..5}$
 $\left[{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}{,}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}{,}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}{,}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}{,}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}\right]$ (3)
 > $\mathrm{with}\left(\mathrm{plots}\right):$
 > $\mathrm{display}\left(\mathrm{Array}\left(\left[\mathrm{display}\left(\mathrm{seq}\left(\mathrm{plot}\left(xi,x=5..10,\mathrm{thickness}=4,\mathrm{color}={\mathrm{origp}}_{i}\right),i=1..5\right)\right),\mathrm{display}\left(\mathrm{seq}\left(\mathrm{plot}\left(xi,x=5..10,\mathrm{thickness}=4,\mathrm{color}={\mathrm{randp}}_{i}\right),i=1..5\right)\right),\mathrm{display}\left(\mathrm{seq}\left(\mathrm{plot}\left(xi,x=5..10,\mathrm{thickness}=4,\mathrm{color}={\mathrm{sortedp}}_{i}\right),i=1..5\right)\right)\right]\right),\mathrm{size}=\left[400,200\right]\right)$

 > 

Compatibility

 • The ColorTools[SortPalette] command was introduced in Maple 18.