I am writing here to point out an exception path that could be improved, which happens upon canvas.draw() if the colors set on an axis are not of an expected type/form. Unfortunately, I don’t have time to package a minimal example but it’s something like the below snippet. I’m hoping the location of the exception will be enough. Happy to file a bug report if deemed appropriate. Let me know.
The error you get is TypeError: unhashable type: 'numpy.ndarray'
with not much pointing you to the source of the problem.
A.
fig,the_ax = plt.subplots()
lc = mc.LineCollection(segs, colors=colors, **kw) #,linewidths=2) #, colors=[...]
the_plot = the_ax.add_collection(lc)
fig.canvas.draw()
try:
colors = the_plot.get_color()
except AttributeError:
pass
else:
the_ax.tick_params(axis='y', colors=colors)
File "/venv/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py", line 407, in draw
self.figure.draw(self.renderer)
File "/venv/lib/python3.7/site-packages/matplotlib/artist.py", line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/venv/lib/python3.7/site-packages/matplotlib/figure.py", line 1864, in draw
renderer, self, artists, self.suppressComposite)
File "/venv/lib/python3.7/site-packages/matplotlib/image.py", line 131, in _draw_list_compositing_images
a.draw(renderer)
File "/venv/lib/python3.7/site-packages/matplotlib/artist.py", line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/venv/lib/python3.7/site-packages/matplotlib/cbook/deprecation.py", line 411, in wrapper
return func(*inner_args, **inner_kwargs)
File "/venv/lib/python3.7/site-packages/matplotlib/axes/_base.py", line 2747, in draw
mimage._draw_list_compositing_images(renderer, self, artists)
File "/venv/lib/python3.7/site-packages/matplotlib/image.py", line 131, in _draw_list_compositing_images
a.draw(renderer)
File "/venv/lib/python3.7/site-packages/matplotlib/artist.py", line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/venv/lib/python3.7/site-packages/matplotlib/axis.py", line 1166, in draw
renderer)
File "/venv/lib/python3.7/site-packages/matplotlib/axis.py", line 1092, in _get_tick_bboxes
for tick in ticks if tick.label1.get_visible()],
File "/venv/lib/python3.7/site-packages/matplotlib/axis.py", line 1092, in <listcomp>
for tick in ticks if tick.label1.get_visible()],
File "/venv/lib/python3.7/site-packages/matplotlib/text.py", line 902, in get_window_extent
bbox, info, descent = self._get_layout(self._renderer)
File "/venv/lib/python3.7/site-packages/matplotlib/text.py", line 275, in _get_layout
if key in self._cached:
TypeError: unhashable type: 'numpy.ndarray'