question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make colorbar in plot_confusion_matrix optional

See original GitHub issue

Right 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:17 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
glemaitrecommented, May 28, 2020

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:

There is an open PR unfortunately. But you can get one of the 770 issues that we have 😃 … <#m_4180447266858538206_> On Wed, 27 May 2020 at 16:04, Idan Kashtan @.***> wrote: Hey, If there’s no one working on it I’d love to do it. (: — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#16519 (comment) https://github.com/scikit-learn/scikit-learn/issues/16519#issuecomment-634682991>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABY32P4FSV4QOLAVGW2CFJDRTUMWXANCNFSM4KZJJDWA . – Guillaume Lemaitre Scikit-learn @ Inria Foundation https://glemaitre.github.io/

Where can I find the ones how don’t have an open PR?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scikit-learn/scikit-learn/issues/16519#issuecomment-635202924, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABY32PYGMUJUDMF7VQIMCTLRTYPHDANCNFSM4KZJJDWA .

– Guillaume Lemaitre Scikit-learn @ Inria Foundation https://glemaitre.github.io/

0reactions
cmarmocommented, Jul 24, 2020

Right! Thanks @avigupta2612! Closing.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found