简体   繁体   中英

Plotly Express Heatmap not working properly

I'm a newbie in Python and i need your help for solving this tricky problem.. I created an heatmap graph with seaborn in order to show Project Managers allocation on projects, and it's owrking properly.

ax = sns.heatmap(result_grouped[spike_cols]*100, cmap=mycmap,vmin=0, vmax=200, linewidths=.05, 
linecolor='lightgray', cbar_kws={'label': '% ore giorno'}) #"YlGnBu"

在此处输入图像描述

I tried to create the same graph with the same data with plotly express, but it seems that it doesn't represent all the data.

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()

在此处输入图像描述

Sample Data 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

Can you please help me?

Solved. The spike_cols list was not sorted. After sorting it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM