Skip to content

"Cannot convert argument type %s to rgba array" % type(c)) #2

@ajackal

Description

@ajackal

In visualize_vectors.py on line 16 the third paramater zs passed to plt.scatter() causes and exception to be thrown when trying to convert to an rgba array. I was able to resolve this issue with minor fixes.

Python Version: 2.7.12
Matplotlib Version: 1.5.1
Numpy Version: 1.11.0

Exception Thrown:

chris@chris-HP-EliteBook-820-G3:~/Projects/IntroductionToMachineLearningForSecurityPros/clustering_example$ python visualize_vectors.py -i secrepo.h5
(10000, 3)
Traceback (most recent call last):
File "visualize_vectors.py", line 32, in
visualize(vectors)
File "visualize_vectors.py", line 17, in visualize
s=200,
File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 3251, in scatter
edgecolors=edgecolors, data=data, **kwargs)
File "/usr/lib/python2.7/dist-packages/mpl_toolkits/mplot3d/axes3d.py", line 2273, in scatter
patches = Axes.scatter(self, xs, ys, s=s, c=c, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/matplotlib/init.py", line 1814, in inner
return func(ax, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/matplotlib/axes/_axes.py", line 3893, in scatter
alpha=alpha
File "/usr/lib/python2.7/dist-packages/matplotlib/collections.py", line 831, in init
Collection.init(self, **kwargs)
File "/usr/lib/python2.7/dist-packages/matplotlib/collections.py", line 117, in init
self.set_facecolor(facecolors)
File "/usr/lib/python2.7/dist-packages/matplotlib/collections.py", line 612, in set_facecolor
self._facecolors = mcolors.colorConverter.to_rgba_array(c, self._alpha)
File "/usr/lib/python2.7/dist-packages/matplotlib/colors.py", line 391, in to_rgba_array
"Cannot convert argument type %s to rgba array" % type(c))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions