Displaying labels of colors shown after using plt.imshow()

I am working on hyperspectral image classification. I am trying to plot groundtruth image using imshow function of matplotlib to get the groundtruth map. I am getting the color image but I want the labels of colors represented by the image. How can I get the labels along with the groundtruth image? Following is my code.
hsi_gt=sio.loadmat(“indian_pines_gt”)[‘indian_pines_gt’]
plt.imshow(hsi_gt)

Archiving cause this is a duplicate of Setting labels to the groundtruth image of Remote sensing image