在热图网格线中混音

发布于 2025-01-31 23:41:48 字数 984 浏览 0 评论 0 原文

我正在关注Matplotlib上的教程,以创建热图:

以稍微修改来运行

ax.grid(which="minor", color="w", linestyle='-', linewidth=3)

代码

ax.grid(which="minor", color="black", linestyle='-', linewidth=1)

我 :

线路中有一个小的失真,将第二行与第三行分开。该线并不完全在细胞行之间。

缩放这种失真,我们有:

​有一个简单的修复吗?

I am following the tutorial on matplotlib for creating heatmaps: https://matplotlib.org/stable/gallery/images_contours_and_fields/image_annotated_heatmap.html#a-simple-categorical-heatmap

I run the code with a slight modification, which is changing the following line:

ax.grid(which="minor", color="w", linestyle='-', linewidth=3)

into

ax.grid(which="minor", color="black", linestyle='-', linewidth=1)

I get the following plot:
enter image description here

There is a small distortion in the line separating the second row with the third row. The line is not exactly between the rows of cells.

Zooming in on this distortion we have:

enter image description here

I believe this is due to aliasing? Is there a simple fix for this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文