Why is my U-matrix visually not separating the classes? I am visualizing the U-matrix generated using a Self Organizing Map codebook to (visually) identify regions of similarity in the data. 

Although I would like to use SOM to identify clusters in unlabeled data, I am running it first with some labeled benchmark data sets to make sure that my implementation is bug free. 

For Iris data set, I can see a clear demarcation between the classes suggesting that the implementation is correct. The classes have been re-labeled as 1,2,3. 

However, when I run the same code on another data set, I can see that SOM was able to map members of different classes together (all the 0s are together and 1s are together and there are two distinct regions), but there is no clear demarcation.

How can I improve the U-matrix or SOM to produce a clear demarcation between the classes?
Is the number of predictor variables in your new dataset large? If so, Euclidean distance can be unreliable due to the curse of dimensionality. You might want to try reducing the dimension of your dataset using Principal Component Analysis or feature selection. Alternatively, you might want to try using a different distance metric, like the cosine similarity.