ax set_yticks(range(len(genre_list))ax set_yticklabels(genre_listpylab title(titlepylab colorbar(pylab grid(falsepylab xlabel('predicted class'pylab ylabel('true class'pylab grid(falsepylab show(when you create confusion matrixbe sure to choose color map (the cmap parameter of matshow()with an appropriate color orderingso that it is immediately visible what lighter or darker color means especially discouraged for these kind of graphs are rainbow color mapssuch as matplotlib' default "jetor even the "pairedcolor map the final graph looks like the following screenshotfor perfect classifierwe would have expected diagonal of dark squares from the left-upper corner to the right-lower oneand light colors for the remaining area in the graphwe immediately see that our fft-based classifier is far away from being perfect it only predicts classical songs correctly (dark squarefor rockfor instanceit prefers the label metal most of the time