Bokeh Graph

本文介绍了如何利用Bokeh库结合数组和numpyarray构建图形,包括设置图表标题、转换x坐标为datetime类型,并探讨了图形的视觉属性和可用工具。
摘要由CSDN通过智能技术生成

利用 Bokeh+数组 建图

导入figurefrom bokeh.plotting import figure 用于绘图;
导入output_filefrom bokeh.io import output_file 用于输出html图片;
导入showfrom bokeh.io import show 用于输出图片;

output_file(“图片名称.html”);
f=figure() 创建figure;
f.line(x,y) 传入x数组,y数组,绘制线型图(rectangle 方块点,circle 圆圈点);
show(f) 输出figure;

#making a basic Boken line Graph

#importing Bokeh
from bokeh.plotting import figure
#容器 figure
from bokeh.io import output_file,show

#prepare some data
x=[1,2,3,4,5]
y=[6,7,8,9,10]  #同样长度

#prepare the output file
output_file("Line.html")       #被创建的名称

#create figure object
f=figure()  #figure

#create Line plot
f.line(x,y)      #传入x,y        #line
#f.circle(x,y)

#write the plot in the figure object
show(f)   #显示figure

Bokeh+numpyarray 建图

传入csv文件建立numpyarraydf=pandas.read_csv()
x为df[‘x’]的series,即array的一个column;
同样赋值y;
后续将x,y赋予figure即可;

#making a basic Boken line Graph

#importing Bokeh
from bokeh.plotting import figure
#容器 figure
from bokeh.io import output_file,show
import pandas

#prepare some data
#x=[1
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值