SortPalette - Maple Help

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 or a Palette object. 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)\left[\right]\right]:$
 > $\mathrm{origp}\left[1..5\right]$
 $\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}\left[\mathrm{combinat}\left[\mathrm{randperm}\right]\left(\left[\mathrm{}\left(1..\mathrm{nops}\left(\mathrm{origp}\right)\right)\right]\right)\right]:$
 > $\mathrm{randp}\left[1..5\right]$
 $\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}\left[1..5\right]$
 $\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}\left[i\right]\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}\left[i\right]\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}\left[i\right]\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.