8000 [MRG] python 3 fix in plot_kmeans_silhouette_analysis.py by lesteve · Pull Request #4266 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[MRG] python 3 fix in plot_kmeans_silhouette_analysis.py #4266

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

Conversation

lesteve
Copy link
Member
@lesteve lesteve commented Feb 18, 2015

To reproduce:

$ ipython --matplotlib -i examples/cluster/plot_kmeans_silhouette_analysis.py

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/home/lesteve/dev/scikit-learn/examples/cluster/plot_kmeans_silhouette_analysis.py in <module>()
    119     # 2nd Plot showing the actual clusters formed
    120     ax2.scatter(X[:, 0], X[:, 1], marker='.', s=30, lw=0, alpha=0.7,
--> 121                 c=map(cm.spectral, cluster_labels.astype(float) / n_clusters))
    122 
    123     # Labeling the clusters

/home/lesteve/anaconda/envs/sklearn-dev/lib/python3.4/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, **kwargs)
   3612                 colors = None  # use cmap, norm after collection is created
   3613             else:
-> 3614                 colors = mcolors.colorConverter.to_rgba_array(c, alpha)
   3615 
   3616         faceted = kwargs.pop('faceted', None)

/home/lesteve/anaconda/envs/sklearn-dev/lib/python3.4/site-packages/matplotlib/colors.py in to_rgba_array(self, c, alpha)
    389         except TypeError:
    390             raise ValueError(
--> 391                 "Cannot convert argument type %s to rgba array" % type(c))
    392         try:
    393             if nc == 0 or c.lower() == 'none':

ValueError: Cannot convert argument type <class 'numpy.ndarray'> to rgba array

@lesteve lesteve force-pushed the python3-fix-plot-kmeans-silhouette-analysis branch from 10edf99 to 7b24628 Compare February 18, 2015 15:26
@ogrisel
Copy link
Member
ogrisel commented Feb 18, 2015

Thanks!

@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.04% when pulling 7b24628 on lesteve:python3-fix-plot-kmeans-silhouette-analysis into f20ff86 on scikit-learn:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.04% when pulling 7b24628 on lesteve:python3-fix-plot-kmeans-silhouette-analysis into f20ff86 on scikit-learn:master.

ogrisel added a commit that referenced this pull request Feb 18, 2015
…tte-analysis

[MRG] python 3 fix in plot_kmeans_silhouette_analysis.py
@ogrisel ogrisel merged commit 3d86d1f into scikit-learn:master Feb 18, 2015
@lesteve lesteve deleted the python3-fix-plot-kmeans-silhouette-analysis branch February 19, 2015 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0