📜  直方图图表 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:20.579000             🧑  作者: Mango

代码示例2
import plotly.express as px
import numpy as np

df = px.data.tips()
# create the bins
counts, bins = np.histogram(df.total_bill, bins=range(0, 60, 5))
bins = 0.5 * (bins[:-1] + bins[1:])

fig = px.bar(x=bins, y=counts, labels={'x':'total_bill', 'y':'count'})
fig.show()