From 464dcdf45d7f934919b61f125c5f5b6f045b096a Mon Sep 17 00:00:00 2001 From: rprkh Date: Fri, 30 Sep 2022 21:31:33 +0530 Subject: [PATCH 1/2] make mean_shift plot colourblind friendly --- examples/cluster/plot_mean_shift.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/cluster/plot_mean_shift.py b/examples/cluster/plot_mean_shift.py index 6a6827e5aa49d..b678a683d663f 100644 --- a/examples/cluster/plot_mean_shift.py +++ b/examples/cluster/plot_mean_shift.py @@ -42,20 +42,21 @@ # Plot result # ----------- import matplotlib.pyplot as plt -from itertools import cycle plt.figure(1) plt.clf() -colors = cycle("bgrcmykbgrcmykbgrcmykbgrcmyk") +colors = ['#dede00', '#377eb8', '#f781bf'] +markers = ["x", "o", "^"] + for k, col in zip(range(n_clusters_), colors): my_members = labels == k cluster_center = cluster_centers[k] - plt.plot(X[my_members, 0], X[my_members, 1], col + ".") + plt.plot(X[my_members, 0], X[my_members, 1], markers[k], color = col) plt.plot( cluster_center[0], cluster_center[1], - "o", + markers[k], markerfacecolor=col, markeredgecolor="k", markersize=14, From a88ea58abd476b82f87ce256f59628b448ab096b Mon Sep 17 00:00:00 2001 From: rprkh Date: Sat, 1 Oct 2022 01:47:07 +0530 Subject: [PATCH 2/2] lint --- examples/cluster/plot_mean_shift.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/cluster/plot_mean_shift.py b/examples/cluster/plot_mean_shift.py index b678a683d663f..46ded7bc43421 100644 --- a/examples/cluster/plot_mean_shift.py +++ b/examples/cluster/plot_mean_shift.py @@ -46,13 +46,13 @@ plt.figure(1) plt.clf() -colors = ['#dede00', '#377eb8', '#f781bf'] +colors = ["#dede00", "#377eb8", "#f781bf"] markers = ["x", "o", "^"] for k, col in zip(range(n_clusters_), colors): my_members = labels == k cluster_center = cluster_centers[k] - plt.plot(X[my_members, 0], X[my_members, 1], markers[k], color = col) + plt.plot(X[my_members, 0], X[my_members, 1], markers[k], color=col) plt.plot( cluster_center[0], cluster_center[1],