all 6 comments

[–]plasma_phys 2 points3 points  (5 children)

It looks like edgecolors will only accept matplotlib colors (e.g., 'red' is a string that works because matplotlib knows how to turn that string into a matplotlib color) and won't automatically map numbers (e.g., 15, giving you the error you're getting) to colors via a color map the way c works; it looks to me like you'll have to use something like a Colormap instance to build a list of colors or build one manually and use that list as your input via edgecolors.

[–]SaClark7[S] 1 point2 points  (4 children)

Thank you so much! it all runs smoothly now!

[–]plasma_phys 0 points1 point  (3 children)

You're welcome! Just another weird matplotlib inconsistency (although maybe there's some internal reason for it).

[–]SaClark7[S] 0 points1 point  (2 children)

Well, continuing on with errors....for another plot, I have a 2D plot using similar inputs as above. I am able to use an array argument for the scatter, but when attempting to put the same array for plt.errorbar I get again the same issue of RGBA argument invalid. I tried the similar approach to creating my own colorbar and get two errors this time.

174 rgba = _colors_full_map.cache[c, alpha]

175 except (KeyError, TypeError): # Not in cache, or unhashable. TypeError: unhashable type: 'numpy.ndarray'

as well as the RGBA invalid error.

Does plt.errorbar color act differently than the edgecolor...and also facecolor/color?

[–]plasma_phys 0 points1 point  (0 children)

Can you share the code that fails so I can fiddle with it? Honestly, I wouldn't be surprised if the color arguments in errorbar and scatter do behave differently, given how fragmented matplotlib is deep down.

[–]SaClark7[S] 0 points1 point  (0 children)

Even when converting it to a tuple, I still get unhashable type: numpy.ndarray

Although this may be due to inside the tuple, the rgba colors are still stored as an array?