Neal,

You can use the built-in color-mapping, like this:

import matplotlib.pyplot as plt

import numpy as np

A = np.array

import colorcet as cc

cmap = cc.m_rainbow

x = A([[0,.25], [0.5, 0.75]])

y = x**2

plt.scatter (x, y, c=x, cmap=cmap)

-------

Eric

On 2020/04/03 10:11 AM, Neal Becker wrote:

> import matplotlib.pyplot as plt

> import numpy as np

> A = np.array

>

> import colorcet as cc

> cmap = cc.m_rainbow

>

> x = A([[0,.25], [0.5, 0.75]])

> y = x**2

> colors = np.empty (x.shape, dtype=object)

> for i in range(2):

> for j in range(2):

> colors[i,j] = cmap(x[i,j])

>

> plt.scatter (x, y, c=colors.flatten())

_______________________________________________

Matplotlib-users mailing list

[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users