Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'color' LineCollection prop overrides 'colors' kwarg in ax.eventplot() #4297

Closed
alimuldal opened this issue Mar 30, 2015 · 0 comments
Closed

Comments

@alimuldal
Copy link
Contributor

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()

eventplot 'color' overrride example

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants