If i have a dataset:
import numpy as np
import matplotlib.pyplot as plt
y = np.array([np.random.randn(10) for k in range(100)])
plt.plot(y)
And a corresponding vector of categorical values:
x = np.array([['nr1', 'nr2'] for k in range(5)]).reshape(10,1)
How do i color according to whether the y is 'nr1' or 'nr2'?
It's also ok if pandas plot() function have an easy way.
It should preferably be scalable so there can be more than two groups in x.


ywith 2 colors based onxi.e. ifx[0]is nr1 then ploty[0]with a particular color, and ifx[1]is nr2 then ploty[1]with a different color?