【发布时间】:2021-09-01 10:16:17
【问题描述】:
我有这样的数据
import pandas as pd
df = pd.DataFrame(
dict(
week=[1, 1, 2, 2, 3, 3] * 2,
layout=["classic", "classic", "modern", "modern"] * 3,
response=["conversion", "exit"] * 6,
cnt=[26, 23, 45, 34, 55, 44, 53, 27, 28, 25, 30, 34],))
我需要像在 excel 中那样使用 plotly 获得这样的条形图:
我不能使用两个类别的主要问题。我的代码:
px.bar(
data_frame=df,
x='week',
y='cnt',
template='plotly_dark',
color = 'layout'
)
但我无法像在 excel 示例中那样显示有关“响应”的信息
【问题讨论】:
-
我的建议对你有什么效果?
标签: python plot plotly bar-chart