# uniqueColors

## PURPOSE

Generate m*n visually distinct RGB colors suitable for display.

## SYNOPSIS

function clrs = uniqueColors( m, n, show, offset )

## DESCRIPTION

     Generate m*n visually distinct RGB colors suitable for display.

     Useful when more than the 6 standard 'rgbcym' colors are needed for
     display. Generate m*n colors by sampling at constant intervals in HSV in
     the H and S channels (while keeping V fixed at 1). In addition, for every
     other level of saturation the H values are offset by half an interval to
     further distinguish each color. Inspired by a blog entry by Bart Mossey
     http://fob.po8.org/node/398, HOWTO: Picking "random colors".

     USAGE
      clrs = uniqueColors( m, n, [show], [offset] )

     INPUTS
      m      - number of saturation levels
      n      - number of distinct hues to use
      show   - optional display of colors
      offset - [1] offset every other row of colors

     OUTPUTS
      clrs   - [m*n x 3] array of rgb colors

     EXAMPLE - standard 6 fully saturated colors
      clrs = uniqueColors(1,6,1);

     EXAMPLE - 24 colors used to plot some points
      clrs = uniqueColors(4,6,1);
      figure(2); clf; hold on; n=size(clrs,1);
      for i=1:n, plot(mod(i-1,6),i,'.','color',clrs(i,:)); end

     See also hsv2rgb, colormap, hsv, jet

     Piotr's Image&Video Toolbox      Version 2.51
     Copyright 2010 Piotr Dollar.  [pdollar-at-caltech.edu]
     Please email me if you find bugs, or have suggestions or questions!
     Licensed under the Lesser GPL [see external/lgpl.txt]

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by: