MATLAB: Is it possible to subplot confusion matrices

confusion matrixplotting

I'm plotting several confusion matrices using plot_confusion() function and want to put them in a subplot (2×5 figures), but it does not seem to work as it would with other figure types. Are there any restriction for plotting confusion? Thanks!

Best Answer

If you refer to plotconfusion() from the Neural Network toolbox, then unfortunately No. I just checked the code for it: if there is a "current figure" then it always clears the entire figure with clf(); if there is no "current figure" then it always creates a new figure. There is no direct way to subplot() it.
What you might be able to do is ensure there is no current figure, then let it generate a new figure, and afterwards go into the figure and extract the parts of interest and move them into a subplot in the place you want, and then delete that figure that it generated.