python - Confusion matrix layout in python
问题描述
I have made a confusion matrix using the code here:
How can I change the layout so that I can see all the numbers in the first and last row without them being cut off?
Thank you!
解决方案
You need to add some padding to the axes by setting the axis ticks like this:
ax.set_xticks(np.arange(cm.shape[1]+1)-.5)
ax.set_yticks(np.arange(cm.shape[0]+1)-.5)
Here is similer matplotlib example.
推荐阅读
- ms-access - 填充表单中的 Microsoft Access 错误
- python - 简单浮点值的问题
- azure - 如何将 Web 服务相互连接并连接到 vnet azure 中的不同其他资源
- angular - 添加新曲目以进行流式传输并开始远程播放
- typescript - onBlur 事件在 Safari 浏览器上不起作用
- python - 为什么我的 CPLEX 问题变得不可行?
- jdbc - 有没有办法通过 JDBC 连接将箭头表写入数据库?
- python - 如何在 TensorFlow 中并行化优化问题?
- flutter - 如何在颤动中动态更改应用程序图标?
- python - 创建一个网络,其中节点使用 networkx 存储多个属性数据