我正在关注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:

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:

I believe this is due to aliasing? Is there a simple fix for this?
发布评论