-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Labels
Milestone
Description
Just came across a minor annoyance in the ax.eventplot()
API. Currently if you pass color=
this overrides the colors=
kwarg, and instead of setting a single color for each row of event markers, it has the effect of setting a repeating color sequence for the markers within every row.
Hopefully this example illustrates what I'm talking about:
import numpy as np
from matplotlib import pyplot as plt
np.random.seed(0)
data1 = np.random.random([20])
data2 = np.random.random([10])
data = [data1, data2]
fig, (ax1, ax2) = plt.subplots(1, 2, sharex=True, sharey=True)
# expected
ax1.eventplot(data, colors=['r', 'b'])
# 'color' overrides 'colors'
ax2.eventplot(data, colors=['r', 'b'], color=['c', 'm'])
plt.show()
It took me an embarrassingly long time to figure out that I needed to pass colors
rather than color
in order to set the color for each row.