Improving colors and looks of graph plots.
[pingpong.git] / python_ml / plotting-dbscan.py
index 6362b2f2043d981134be556e7a59dd69e2ffc398..733fe16243e461afcdaf466186d8bc96e3359867 100644 (file)
@@ -12,8 +12,8 @@ fig.set_size_inches(7, 7)
 # Read from file
 # TODO: Just change the following path and filename 
 #      when needed to read from a different file
-path = "/scratch/July-2018/Pairs/"
-device = "dlink-off"
+path = "/scratch/July-2018/Pairs2/"
+device = "kwikset-off"
 filename = device + ".txt"
 
 # Number of triggers
@@ -62,7 +62,7 @@ for k, col in zip(unique_labels, colors):
 
     xy = X[class_member_mask & core_samples_mask]
     plt.plot(xy[:, 0], xy[:, 1], 'o',
-             markeredgecolor='k', markersize=14)
+             markeredgecolor='k', markersize=10)
 
     xy = X[class_member_mask & ~core_samples_mask]
     plt.plot(xy[:, 0], xy[:, 1], 'o', markerfacecolor=tuple(col),
@@ -73,9 +73,13 @@ for pair in pairsArr:
        #if labels[count] != -1:
        # If this is not a noise (i.e.,real data)
        #       plt.text(pair[0], pair[1], "Freq: " + str(labels.tolist().count(labels[count])), fontsize=10)
-       
-       plt.text(pair[0], pair[1], str(pair[0]) + ", " + str(pair[1]) + 
-               "\nFreq: " + str(labels.tolist().count(labels[count])), fontsize=10)
+
+       if labels[count] == -1:
+               plt.text(pair[0], pair[1], str(pair[0]) + ", " + str(pair[1]), fontsize=10)
+       else:
+       # Only print the frequency when this is a real cluster
+               plt.text(pair[0], pair[1], str(pair[0]) + ", " + str(pair[1]) + 
+                       "\nFreq: " + str(labels.tolist().count(labels[count])), fontsize=10)
        count = count + 1