python - Plotly Express 热图无法正常工作
问题描述
我是 Python 的新手,我需要你的帮助来解决这个棘手的问题。我用 seaborn 创建了一个热图,以显示项目经理在项目上的分配,并且它运行正常。
ax = sns.heatmap(result_grouped[spike_cols]*100, cmap=mycmap,vmin=0, vmax=200, linewidths=.05,
linecolor='lightgray', cbar_kws={'label': '% ore giorno'}) #"YlGnBu"
我尝试使用 plotly express 创建具有相同数据的相同图表,但它似乎并不能代表所有数据。
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
spike_cols = [col for col in result_grouped.columns if '2021-' in col]
fig = px.imshow(result_grouped[spike_cols],
#x=spike_cols,
y=result_grouped.index,
width=900, height=800
)
fig.show()
示例数据 PM IT|17/02/2021|18/02/2021|19/02/2021|22/02/2021|23/02/2021|24/02/2021|25/02/2021|26/02 /2021 ito|0.753503|0.753503|0.752568|0.752568|0.752568|0.614762|0.610097|0.572597 nzi|0.716667|0.716667|0.716667|0.716667|0.716667|0.716667|0.658333|0.633333
你能帮我么?
解决方案
解决了。peak_cols 列表未排序。排序后就可以了。
推荐阅读
- extjs - Extjs 6 组合框「queryMode: 'local'」数据未显示
- c# - Task.Run 取消
- regex - 如何在 Emacs Lisp 中编写用于语法高亮的函数?
- git - Git hooks 强制消息格式
- javascript - 正则表达式验证 GMT 和中文日期时间格式
- tensorflow - 张量流如何*有效地*计算从输入到损失的梯度?
- r - 将长列表转换为具有重复项的二进制数据帧
- ios - 如何将 NSData 从 zipFile 转换为 char *
- c++ - 为浮点数组动态分配内存
- language-agnostic - 键入命令并立即执行的工作模式的名称