1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Plot confusion matrix in black and white

Discussão em 'Python' iniciado por Stack, Julho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I currently have the following code:

    disp = ConfusionMatrixDisplay(confusion_matrix=cm)
    disp.plot()
    plt.show()


    This results into something like:

    [​IMG]

    However, I want the diagonal to be depicted with a black background, and the off-diagonal with a white background, that is something like:

    [​IMG]

    How can I change the cell colors accordingly?

    Continue reading...

Compartilhe esta Página