python - matplotlib:如何添加像素值范围的图例?
问题描述
我正在尝试使用以下代码可视化图像。如何在此图像中添加图例以表示像素的值范围?
first_layer_activation = activations[31]
print(first_layer_activation.shape)
结果:(1, 16, 16, 1)
import matplotlib.pyplot as plt
plt.matshow(first_layer_activation[0, :, :, 0], aspect='auto', cmap='viridis')
解决方案
你的意思是这样的plt.colorbar()
吗?
推荐阅读
- php - 无法使用 composer 在 laravel 中安装 PHP-FFMpeg/PHP-FFMpeg 库
- javascript - Typescript:如何管理具有冲突类型声明的依赖项?
- tensorflow - Keras NN 产生的结果具有良好的可变性预测但幅度预测较差
- php - 如何对总值求和
- sql - SQL 函数从列中解析出文本
- c# - 删除一个查询参数值
- racket - 球拍:如何防止图像离开屏幕而出现在另一侧?
- java - libGDX 出错,窗口立即打开和关闭
- javascript - 如何使 `window.scrollTo` 更精确?
- javascript - 事件触发时本地 DOM 元素上的 Polymer 2 TypeError