Hi I am new to python and am running into some trouble plotting some time series data as lines while trying to set the color of each line based on a value associated with each line which is stored in a numpy array, here stored as colorValues.
I have a matrix of data to plot, yValues across their corresponding xValues. I want to set the color of each line based on a value for each stored in an array, colorValues. This is following the example here (where using plt.scatter an array of 0's and 1's is entered for the color values as c=someArray).
import matplotlib.pyplot as plt
import numpy as np
yValues
>>>matrix([[-0.33, -0.93, 0.94, -0.17, 0.62],
[ 0.06, -0.87, 1.1 , -0.17, 0.12],
[-0.01, -0.78, 0.88, -0.17, 0.18],
[-0.19, -0.87, 0.94, -0.56, 0.21],
[-0.08, -0.72, 0.88, -0.35, 0.15]])
xValues = ['1','2','3','4','5']
colorValues = np.array([1, 1, 1, 0, 0])
plt.plot(xValues, yValues, color=colorValues)
plt.show()
However, when I run the code using color=colorValues or c=colorValues it returns the following error:
ValueError: RGBA sequence should have length 3 or 4