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 = np.random.rand(n,ncols)
for c in range(ncols):
    arr[:,c] += c
x = np.random.rand(n)
y = np.random.rand(n)
colors = sc.arraycolors(arr)
plt.figure(figsize=(20,16))
for c in range(ncols):
    plt.scatter(x+c, y, s=50, c=colors[:,c])

Version: 2020mar07

New in version 3.1.0: Handle non-array output