Function: makePaintballKey()
makePaintballKey(
colors
,labels
,opts?
):SVGElement
Defined in: ColorBar.ts:316
Make an SVG containing a color key for a paintball plot. The key can be split over any number of columns.
Parameters
Parameter | Type | Description |
---|---|---|
colors | (string | Color )[] | A list of colors |
labels | string [] | The labels corresponding to each color |
opts? | PaintballKeyOptions | The options for creating the color key |
Returns
SVGElement
An SVGElement containing the color bar image.
Example
// Create the color key
const svg = makePaintballKey(colors, labels, {n_cols: 2, fontface: 'Trebuchet MS'});
// Add the color key to the page
document.getElementById('pb-key-container').appendChild(svg);