Python中文
首页
教程
问答
标签
搜索
登录
注册
在Python中为不同的ndarray索引分配相同的值
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>问题可能不清楚,所以我你用代码解释:</p> <pre><code>@staticmethod def generate_data_uncertainty_heat_map(data_property, data_uncertainty, file_path): plt.figure() uncertainty = numpy.zeros((data_property.rows, data_property.cols, 4), 'uint8') uncertainty[..., 0] = uncertainty[..., 1] = uncertainty[..., 2] = numpy.uint8(data_property * 255) uncertainty[..., 3] = numpy.uint8(data_uncertainty) fig = plt.imshow(uncertainty, extent=[0, data_property.cols, data_property.rows, 0]) plt.colorbar(fig) plt.savefig(file_path + '.png') plt.close() </code></pre> <p>这需要两个(n,n)ndarray来形成一个带有<strong>matploblib</strong>的RGBA图像。 为此,我使用<strong>data_属性</strong>参数作为我的RGB,<strong>数据不确定性</strong>作为我的不透明度。在</p> <p>我基本上想知道我是否会写作</p> ^{pr2}$ <p>另一方面,对于不确定度[…,0或1或2]</strong>来说,该值应该是<strong>纽比.uint8(数据属性*255)</strong>。在</p> <p>提前谢谢你。在</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>是的,你可以,只要<code>data_property</code>与<code>uncertainty[..., 0]</code>具有相同的<code>shape</code></p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
jupyter运行一个旧的pytorch版本
1 回答
Jupyter运行不同版本的卸载库?
5 回答
Jupyter运行指定的键盘快捷键
9 回答
Jupyter通过.local文件“逃逸”virtualenv。我该如何缓解这种情况?
5 回答
Jupyter重新加载自定义样式
3 回答
Jupyter错误:“没有名为Jupyter_core.paths的模块”
4 回答
jupyter错误:无法在随机林中将决策树视为png
7 回答
Jupyter错误'内核似乎已经死亡,它将自动重新启动'为一个给定的代码块
1 回答
Jupyter错误地用阿拉伯语和字母数字元素显示Python列表
6 回答
Jupyter隐藏数据帧索引,但保留原始样式
1 回答
Jupyter集线器:启动器中出现致命错误。。。系统找不到指定的文件
3 回答
Jupyther中相同值的相同哈希,但导出到Bigquery时不相同
7 回答
Jupy上Python的读/写访问问题
4 回答
jupy上没有模块cv
7 回答
Jupy上的排序错误
4 回答
Jupy中bqplot图形的紧凑布局
5 回答
Jupy中matplotlib plot的连续更新
5 回答
Jupy中Numpy函数的文档
5 回答
Jupy中Pandas的自动完成问题
5 回答
jupy中Qt后端的Matplotlib动画
5 回答