I'm simply trying to plot some tick marks with a specific color using matplotlib's eventplot. I'm running Python 3 in Jupyter notebook with %matplotlib inline.
Here's an example code:
import numpy as np
import matplotlib.pyplot as plt
spikes = 100*np.random.random(100)
plt.eventplot(spikes, orientation='horizontal', linelengths=0.9, color=[0.3,0.3,0.5])
It outputs the following error:
ValueError: colors and positions are unequal sized sequences
The error occurs presumably because I am not providing a list of colors of the same length as the data (but I wan't them to all just be the same color!). It also gives an error when I use a color string like 'crimson' or 'orchid'. But it works when I use a simple one-letter string like 'r'.
Am I really restricted to just using the extremely limited set of one-letter color strings 'r','b','g','k','m','y', etc... or making a long color list when using this eventplot?
color=[0.3,0.3,0.5]
? When you provide a list as a color parameter, matplotlib understands you want the first event to be color[0], second to be color[1], ....color = (0.3,0.3,0.5)
, this way, as a tuple, that should work.