本文研究的主要是python可视化包Bokeh的相关内容,具体如下。
问题:需要把pandas的数据绘图并通过网页显示,matplotlib需要先保存图像,不合适。
解决:在网上搜了一下,找到一篇介绍文章 python可视化工具概述,其中介绍了几个python包,总结如下:
p = figure(title = code, plot_width=1024, plot_height=600, x_axis_type='datetime') p.line(x=trd_df['date'], y=trd_df['close']) script, div = components(p)
return render_template('show_stock.html', 
bk_js = bokeh.resources.INLINE.render_js(),
bk_css = bokeh.resources.INLINE.render_css(), 
p_script = script, div = p_div)
<!doctype html> 
<html lang="en"> 
<head> 
  <meta charset='utf-8' /> 
  <meta http-equiv='content-type' content='text/html; charset=utf-8' /> 
 
  <title>Embed Demo</title> 
 
  {{ js_resources|indent(4)|safe }} 
 
  {{ css_resources|indent(4)|safe }} 
 
  {{ p_script|indent(4)|safe }} 
 
</head> 
<body> 
 
  {{ p_div|indent(4)|safe }} 
 
</body> 
</html> 
以上就是本文关于浅谈python可视化包Bokeh的全部内容,希望对大家有所帮助。感兴趣的朋友可以继续参阅本站其他相关专题,如有不足之处,欢迎留言指出。感谢朋友们对本站的支持!
声明:本文内容来源于网络,版权归原作者所有,内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎点击右下角反馈进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。