简体   繁体   English

Matplotlib imshow显示所有像素

[英]Matplotlib imshow show all pixels

I am looking for a way to guarantee that in matplotlib's imshow, all pixels are visible in the resulting figure. 我正在寻找一种方法来保证在matplotlib的imshow中,所有像素在结果图中可见。

I use imshow to depict recurrence plots, where I need to be able to see fine lines of 1px thickness, because they can indicate something interesting going on. 我使用imshow描绘重复图,在这里我需要能够看到1px粗的细线,因为它们可以指示出一些有趣的事情。

Within Jupyter notebook, imshow is printed in the given figsize, and if that figsize is too small, small lines in the plot can disappear. 在Jupyter笔记本中,imshow将以给定的figsize打印,如果该figsize太小,图中的细线可能会消失。 How can I ensure that matplotlib and jupyter notebook do not to resize the image, but show all pixels? 如何确保matplotlib和jupyter笔记本不调整图像大小,而是显示所有像素?

If the 1px lines are spotty and visible when zooming in, you can make them visible by enabling interpolation: 如果1px的线斑点不清晰且在放大时可见,则可以通过启用插值使其可见:

axes.imshow(edges, cmap=plt.cm.gray, interpolation="bilinear")

Before: 之前:

在此处输入图片说明

After: 后:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM