作者jojojen (JJJ)
看板Python
标题[问题] plotly如何用按键切换颜色参数抓取的栏位
时间Sat Jun 6 08:12:40 2020
前辈大大们各位好,
以下这两张图是我想做出的效果
https://imgur.com/qlrLBqu
https://imgur.com/8AGG340
我用以下的程式码可以画出类似的介面
但点击按钮无法更新/改变图表:
import plotly.express as px
df = px.data.tips()
fig = px.scatter(df, x="total_bill", y="tip", color="smoker")
## How to fix this part?
fig.update_layout(
updatemenus=[
dict(
type = "buttons",
direction = "left",
buttons=list([
dict(
args=["color", "sex"],
label="sex",
method="update"
),
dict(
args=["color", "smoker"],
label="smoker",
method="update"
)])),])
fig.show()
##
请问该如何修改,或用其他哪种套件能达到我想要的效果?
再请麻烦大大们指教 谢谢各位
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 125.215.153.241 (香港)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1591402364.A.894.html
1F:推 skyconquer: 我回了一篇有类似效果的文在底下,请参考。 06/07 21:54