1 Star 0 Fork 0

1991wangliang / Python-Motion-Detector

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
plotting.py 861 Bytes
一键复制 编辑 原始数据 按行查看 历史
Daniel Huang 提交于 2018-01-09 03:10 . hover feature implemented
from motion_detector import df
from bokeh.plotting import figure, show, output_file
from bokeh.models import HoverTool, ColumnDataSource
#convert the datetime datatype to string
df["Start_str"] = df["Start"].dt.strftime("%Y-%m-%d %H:%M:%S")
df["End_str"] = df["End"].dt.strftime("%Y-%m-%d %H:%M:%S")
cds = ColumnDataSource(df)
p = figure(x_axis_type = "datetime", height = 100, width = 500, responsive = True, title = "Motion Graph")
p.yaxis.minor_tick_line_color = None #hide the unnecessary ticks on y-axis
p.ygrid[0].ticker.desired_num_ticks = 1 #hide the intermmediate lines/grid in the graph
#draw the bar chart with the quad glyph
hover = HoverTool(tooltips = [("Start", "@Start_str"), ("End", "@End_str")])
p.add_tools(hover)
q = p.quad(left = "Start", right = "End", top=1, bottom=0, color = "green",source = cds)
output_file("Graph.html")
show(p)
1
https://gitee.com/wangliang1991/Python-Motion-Detector.git
git@gitee.com:wangliang1991/Python-Motion-Detector.git
wangliang1991
Python-Motion-Detector
Python-Motion-Detector
master

搜索帮助