When plotting the confusion matrix, how to reorder the class according to the super class

Hi, I am now plotting the confusion matrix. In my case, the model was trained to predict 1654 categories. then the confusion matrix is of size 1654 * 1654. But these categories can be grouped into 49 super classes. Then I intend to reorder the confusion matrix and make the categories belonging to the same super class together. Does anybody know how to realize it?