sciris.sc_colors.arraycolors

arraycolors(arr, **kwargs)[source]

Map an N-dimensional array of values onto the current colormap. An extension of vectocolor() for multidimensional arrays; see that function for additional arguments.

Parameters
  • arr (array) – a multidimensional array to be converted to an array of colors

  • kwargs (dict) – passed to sc.vectocolor()

Example:

n = 1000
ncols = 5
arr = pl.rand(n,ncols)
for c in range(ncols):
    arr[:,c] += c
x = pl.rand(n)
y = pl.rand(n)
colors = sc.arraycolors(arr)
pl.figure(figsize=(20,16))
for c in range(ncols):
    pl.scatter(x+c, y, s=50, c=colors[:,c])

Version: 2020mar07