QCustomPlot Discussion and Comments

How to plot a confusion matrix Return to overview

I want to plot a confusion matrix, you can see an example of the plot at this https://towardsdatascience.com/multi-class-classification-extracting-performance-metrics-from-the-confusion-matrix-b379b427a872

So far, i can create a matrix and set data to QCPColormap then QCPColormap::setInterpolate(false) to achive the matrix-like plot. However, i dont know how to show a number for each cell in the plotted matrix.

Hi,

A first solution would consists in adding as may QCPItemText objects as cells, but it may have terrific performance if your matrix is quite large. The other one consists in subclassing QCPColormap and rewriting the appropriate methods (I would start by looking at the draw method).

Vincent