You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
eventplot: allow a list of alpha channels as in the case with colors #19376
Traceback (most recent call last):
File "/home/ulianych/anaconda3/envs/viziphant/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-fab7f3737c6e>", line 1, in <module>
plt.eventplot([[0, 1, 2], [0.5, 2.3]], alpha=[0.5, 0.2])
File "/home/ulianych/anaconda3/envs/viziphant/lib/python3.7/site-packages/matplotlib/pyplot.py", line 2622, in eventplot
**({"data": data} if data is not None else {}), **kwargs)
File "/home/ulianych/anaconda3/envs/viziphant/lib/python3.7/site-packages/matplotlib/__init__.py", line 1447, in inner
return func(ax, *map(sanitize_sequence, args), **kwargs)
File "/home/ulianych/anaconda3/envs/viziphant/lib/python3.7/site-packages/matplotlib/axes/_axes.py", line 1480, in eventplot
coll.update(kwargs)
File "/home/ulianych/anaconda3/envs/viziphant/lib/python3.7/site-packages/matplotlib/artist.py", line 998, in update
ret.append(func(v))
File "/home/ulianych/anaconda3/envs/viziphant/lib/python3.7/site-packages/matplotlib/collections.py", line 834, in set_alpha
super().set_alpha(alpha)
File "/home/ulianych/anaconda3/envs/viziphant/lib/python3.7/site-packages/matplotlib/artist.py", line 930, in set_alpha
raise TypeError('alpha must be a float or None')
TypeError: alpha must be a float or None
You are right, the behavior was modified (likely unintendedly). While this was raising before, the alpha sequence is now cycling within each dataset / LineCollection. We instead want to sequentially take the alpha values one value per LineCollection.
Activity
mwaskom commentedon Jan 27, 2021
You can pass colors as rgba values, so like
should do it
dizcza commentedon Jan 27, 2021
But I don't want to specify the colors.
-_-
Moritz-Alexander-Kern commentedon Nov 3, 2022
This is solved ?
Running:
produces the following plot:

Python: 3.8.10
matplotlib: 3.6.2
timhoffm commentedon Nov 4, 2022
This got fixed as a side effect of #22451.
mwaskom commentedon Nov 5, 2022
Is that example the expected behavior? I would expect the top row to both be 0.5 and the bottom row to all be 0.2.
timhoffm commentedon Nov 11, 2022
You are right, the behavior was modified (likely unintendedly). While this was raising before, the alpha sequence is now cycling within each dataset / LineCollection. We instead want to sequentially take the alpha values one value per LineCollection.
This needs explicit handling at
matplotlib/lib/matplotlib/axes/_axes.py
Lines 1377 to 1386 in cd185ab