【发布时间】:2021-03-01 18:19:07
【问题描述】:
我正在尝试使用 seaborn 和 mpld3 但在 .html 文件中显示图表。当我使用命令mpld3.show() 时,会弹出一个新窗口,并且该图显示在创建的本地网络服务器中(如文档所述)。但是,当尝试将其保存在 .html 文件中时,图表为空,但我可以看到一些图标,如移动和缩放可用....
与mpld3.show()
sns.set(style="whitegrid")
sns.barplot(x=df.index.tolist(), y=df['Salário'])
mpld3.show()
图表应该是怎样的:
尝试使用 save_html() 保存到 .html 文件:
sns.set(style="whitegrid")
sns.barplot(x=df.index.tolist(), y=df['Salário'])
fig = plt.figure()
mpld3.save_html(fig, "./templates/graph_exp.html")
带有工作图标的错误图表
有人可以帮我让这个图表看起来正常保存到 .html 文件吗? :)
【问题讨论】:
-
我建议编码为base 64
标签: python flask seaborn mpld3