【发布时间】:2021-07-20 04:27:04
【问题描述】:
我有这个 unstack 数据集
| day | Thur | Fri | Sat | Sun |
|---|---|---|---|---|
| sex | ||||
| Male | 30 | 10 | 59 | 58 |
| Female | 32 | 9 | 28 | 18 |
现在如何使用 Plotly-Python 生成热图,其中 x 值为“day”,y 值为“sex”。
【问题讨论】:
标签: plotly data-visualization heatmap data-analysis plotly-python
我有这个 unstack 数据集
| day | Thur | Fri | Sat | Sun |
|---|---|---|---|---|
| sex | ||||
| Male | 30 | 10 | 59 | 58 |
| Female | 32 | 9 | 28 | 18 |
现在如何使用 Plotly-Python 生成热图,其中 x 值为“day”,y 值为“sex”。
【问题讨论】:
标签: plotly data-visualization heatmap data-analysis plotly-python
您可以使用 plotly-express' px.imshow
import plotly_express as px
fig = px.imshow(df, color_continuous_scale='viridis')
fig.show()
文档:https://plotly.com/python/heatmaps/
彩图列表:https://plotly.com/python/builtin-colorscales/
【讨论】: