Confusion Matrix
Chart overview
A confusion matrix displays the counts of correct and incorrect predictions for each class in a classification model, arranged as a square grid.
Key points
- Researchers in machine learning use it to identify which classes a model confuses with one another, revealing precision, recall, and F1-score trade-offs at a glance.
- It is the starting point for diagnosing and improving any supervised classification system.
Example Visualization

Create This Chart Now
Generate publication-ready confusion matrixs with AI in seconds. No coding required – just describe your data and let AI do the work.
View example prompt
"Create a confusion matrix heatmap from my classification results. Use a diverging colormap, annotate each cell with counts and percentages, label axes with class names, and add a colorbar. Normalize rows to show recall per class when requested."
How to create this chart in 30 seconds
Upload Data
Drag & drop your Excel or CSV file. Plotivy securely processes it in your browser.
AI Generation
Our AI analyzes your data and generates the Confusion Matrix code automatically.
Customize & Export
Tweak the design with natural language, then export as high-res PNG, SVG or PDF.
Python Code Example
Console Output
Figure saved: plotivy-confusion-matrix.png
Common Use Cases
- 1Evaluating multi-class image classification model performance
- 2Diagnosing which disease classes are confused in a medical AI system
- 3Comparing model performance before and after hyperparameter tuning
- 4Reporting per-class accuracy in NLP text classification tasks
Pro Tips
Normalize rows to show recall per class when class sizes are imbalanced
Use a sequential colormap (Blues) for normalized matrices to avoid misleading divergence
Rotate x-axis labels 45 degrees when class names are long to prevent overlap
Add a classification report table below the matrix for precision and F1 scores
Scientific Chart Selection Cheat Sheet
Not sure whether to use a Violin Plot, Box Plot, or Ridge Plot? Download our single-page reference mapping the most-used scientific chart types, exactly when to use them, and the core Matplotlib/Seaborn functions.