Make colorbar in plot_confusion_matrix optional
See original GitHub issueRight now plot_confusion_matrix
(and ConfusionMatrixDisplay
) always add a color bar.
That’s sometimes a bit ugly and also doesn’t add that much information if the values are already shown in the heatmap.
Unfortunately it’s a bit tricky to remove a colorbar from an axes; I had to employ stackoverflow, not sure if others know it.
Spoiler
# assuming there's only one image in the axes # which is true in this case, this removes the colorbar from ax ax.images[0].colorbar.remove()
I think it would be good to add a boolean colorbar
to both plot_confusion_matrix
and ConfusionMatrixDisplay.plot
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:17 (12 by maintainers)
Top Results From Across the Web
sklearn plot confusion matrix with labels - Stack Overflow
UPDATE: In scikit-learn 0.22, there's a new feature to plot the confusion matrix directly (which, however, is deprecated in 1.0 and will be...
Read more >Plot a confusion matrix - YouTube
New in scikit-learn 0.22: Plot a confusion matrix in one line of code!Highly customizable, including the colormap, display labels, ...
Read more >sklearn.metrics.ConfusionMatrixDisplay
Plot the confusion matrix given an estimator, the data, and the label. ConfusionMatrixDisplay. ... Whether or not to add a colorbar to the...
Read more >Alignment of colorbar with colorbar to name - TeX
Here, the colorbar to name option takes care of using the same colorbar for all plots (there is a warning from pdflatex on...
Read more >Confusion Matrix — Yellowbrick v1.5 documentation
Class names can be added to a ConfusionMatrix plot using the ... This method will build the ConfusionMatrix object with the associated arguments,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You need to check the issue and see if there is a PR link to it. An easy way (but not definitive one) is to check https://github.com/scikit-learn/scikit-learn/issues and you can see a PR icon when the issue is linked to a PR already. Be aware that sometimes a PR has been opened and it can be stalled. In this case, it is nice to take over to finish the work.
On Thu, 28 May 2020 at 10:38, Idan Kashtan notifications@github.com wrote:
– Guillaume Lemaitre Scikit-learn @ Inria Foundation https://glemaitre.github.io/
Right! Thanks @avigupta2612! Closing.