px.imshow / go.Heatmap.
Goal
Run every block and confirm the chart is visible.
df = pd.DataFrame({
"city": ["Nairobi", "Mombasa", "Kisumu", "Nakuru", "Eldoret"],
"units": [21, 15, 15, 18, 12],
"shillings": [2100, 1500, 1480, 1750, 1190],
})
fig = px.density_heatmap(df, x="city", y="units") if False else px.imshow([[12,9],[7,8],[11,4]], labels=dict(x="product", y="city"), x=["mango","soda"], y=["Nairobi","Mombasa","Kisumu"], title="heat")
fig.show()
print('heat')df = pd.DataFrame({
"city": ["Nairobi", "Mombasa", "Kisumu", "Nakuru", "Eldoret"],
"units": [21, 15, 15, 18, 12],
"shillings": [2100, 1500, 1480, 1750, 1190],
})
fig = px.density_heatmap(df, x="city", y="units") if False else px.imshow([[12,9],[7,8],[11,4]], labels=dict(x="product", y="city"), x=["mango","soda"], y=["Nairobi","Mombasa","Kisumu"], title="heat")
fig.update_layout(width=480, height=320)
fig.show()
print("sized")df = pd.DataFrame({
"city": ["Nairobi", "Mombasa", "Kisumu", "Nakuru", "Eldoret"],
"units": [21, 15, 15, 18, 12],
"shillings": [2100, 1500, 1480, 1750, 1190],
})
fig = px.bar(df, x="city", y="units", title="always a bar nearby")
fig.show()
print("bar")print('heat')