Clustering is an important tool for unsupervised machine learning. Examples of clustering often start with a description of a contrived dataset to give some intuition as to why the clusters should end up as they do. Colors need no such description; we know if something is reddish or a shade of blue.

To strengthen intuition, we contrive to force the clustering. Each color in the RGB color space can be represented by a point in the unit cube, and distance can be ordinary Euclidean distance. Three points are chosen in RGB space: one that is close to pure red, another close to pure green and the last close to pure blue. A random collection of points that are near each of these points is generated, where "near" means within a sphere of radius 0.2 around each point.

To visualize each cluster, we find the convex hull of each set of points and shade that with the color associated with one of the original three points. We pick this by looking at which one is closest to the centroid for the cluster. As the number of points is increased, the convex hull forms a closer approximation to a sphere.