【问题标题】:remove smoothness effect on edge with matplotlib pyplot使用 matplotlib pyplot 消除边缘的平滑效果
【发布时间】:2021-09-14 05:14:51
【问题描述】:

我想在绘制图像时消除边缘的模糊效果。以下是最小可重现代码:

import numpy as np
import matplotlib.pyplot as plt

im = np.zeros((512,512))
im[30:100,40:80]=1
im[200:250,300:350]=2
plt.figure(figsize=(20,13))
plt.imshow(im)

您可以看到矩形边缘的绿色。有什么帮助吗?

【问题讨论】:

    标签: matplotlib plot blur smoothing


    【解决方案1】:

    我通过将interpolation="none" 添加到plt.imshow(..) 解决了这个问题。

    【讨论】:

      猜你喜欢
      • 2014-08-09
      • 1970-01-01
      • 2017-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-27
      相关资源
      最近更新 更多