Plot_confusion_matrix vertical alignment?

Hi everyone,

I started watching the online lessons yesterday and it shocked me that when plotting the confusion matrix with plot_confusion_matrix() the numbers in the matrix are only horizontally aligned but not vertically aligned. I checked the source code and I saw that horizontalalignment="center" is specified but the vertical alignment is left at its default. Is it on purpose?

I could make a pull request to add the verticalalignment="center", it should not affect the tests, break anything nor require extra tests.

I don’t think it’s on purpose, so you’re welcome to suggest a PR to fix this.

1 Like

Thanks for the fast reply. I have already suggested the PR.

I’m experiencing vertical alignment issues with plot_confusion_matrix text:

Tried all of top, bottom, center, baseline, center_baseline for verticalalignment value, but none seemed to work properly.

1 Like

Me too - did you solve this?

This looks like an issue with the y-axis limits, which is why no alignment value solves the issue.

1 Like