Swatches - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

ColorTools

 Swatches
 plot squares of color

 Calling Sequence Swatches(colors, opts)

Parameters

 colors - list of colors in formats recognized by ColorTools or a Palette object or name opts - (optional) equation(s) of the form option=value where option is one of rows, gap, borders, mode, filter, bottomup or any valid option for 2-D plots; see plot/options

Options

 • rows= positive integer
 The number of rows in which to lay out the colors
 • gap= constant between 0 and 1
 The distance between color squares
 • borders=list
 A list of the two colors to use for the backgrounds of the plot if either color is give as an empty list or FAIL then the corresponding background will be omitted from the plot. If borders=[] then both backgrounds will be omitted.
 • bottomup=true or false
 If true, the first color in the palette will appear in the bottom left corner instead of the top left.
 • filter=procedure
 A procedure to apply to every color before rendering
 • mode=name (one of the following)
 Shortcuts to set a number of options for a specific effect.
 – mode=compact creates a small plot with no borders or gaps
 – mode=gradient creates a single thin row with no borders or gaps
 – mode=wheel creates a gradient as an annulus

Description

 • The Swatches command creates a plot of squares of the input colors.  The colors are laid out into a grid that is as close to square as possible by default. This can be overridden with the rows option.

Examples

 > $\mathrm{with}\left(\mathrm{ColorTools}\right):$
 > $\mathrm{Swatches}\left(\left["Red","Green","Blue","Yellow"\right]\right)$
 > $\mathrm{Swatches}\left(\left["Red","Green","Blue","Yellow"\right],\mathrm{rows}=1,\mathrm{gap}=0.,\mathrm{borders}=\left["White","White"\right]\right)$

Palette objects can be passed in directly

 > $\mathrm{Swatches}\left(\mathrm{GetPalette}\left("Executive"\right)\right)$

Known palettes can be passed in by name

 > $\mathrm{Swatches}\left("X11",'\mathrm{mode}'='\mathrm{compact}'\right)$

The filter option is good for checking a palette's properties when viewed by a user with CVD or viewed in grayscale

 > $\mathrm{Swatches}\left("Turbo",'\mathrm{mode}'='\mathrm{gradient}','\mathrm{filter}'=\mathrm{CVDSimulation}\right)$
 > $\mathrm{Swatches}\left("Magma",'\mathrm{mode}'='\mathrm{gradient}','\mathrm{filter}'=\left(c→\mathrm{Color}\left("Gs",c\right)\right)\right)$

Compatibility

 • The ColorTools:-Swatches command was introduced in Maple 16.
 • For more information on Maple 16 changes, see Updates in Maple 16.
 • The bottomup option was introduced in Maple 2017.
 • For more information on Maple 2017 changes, see Updates in Maple 2017.
 • The ColorTools:-Swatches command was updated in Maple 2023.
 • The filter and mode options were introduced in Maple 2023.
 • For more information on Maple 2023 changes, see Updates in Maple 2023.

 See Also