python-3.x - 为什么最后一个子图中没有图表?
问题描述
我正在编写此代码来单独计算图像的每个补丁的归一化直方图。但是最后一个补丁有一个空图。
from skimage.io import imread
from matplotlib import pyplot as plt
def patches(array, rows, cols):
h, w = array.shape
return (array.reshape(h//rows, rows, -1, cols)
.swapaxes(1,2)
.reshape(-1, rows, cols))
img= imread('example.bmp')
b = patches(img,256,256)
for i in range(1, o+1):
plt.hist(b[i-1].ravel(),256,[0,256])
plt.subplot(v, v, i)
plt.show()
解决方案
推荐阅读
- android-studio - 约束布局中的所有小部件都卡在 Android Studio 的左上角
- php - 如何在 Laravel Mailable 中启用 HTML
- reactjs - 使用 Cypress 未能通过 XHR 请求的测试
- linux - 在 Docker 容器中使用 root 用户挂载 CIFS 时出错
- c# - Asp.net Core C# 中的 Json-RPC
- javascript - 从另一个数组在 JavaScript 中创建新的对象数组
- javascript - 如何从 json 对象中删除嵌套键?
- javascript - 如何在使用苹果登录时在 Firebase 网站上设置重定向 url
- seaborn - 在 spyder 中使用 seaborn 根据列中的值间隔 x 轴
- javascript - 如何根据用户在服务器上的本地日期时间执行操作