2017-02-16 55 views
1

說我有數據繪製了50年背景虛化顯示放大的,從開始的情節

import pandas as pd 
from bokeh.charts import TimeSeries 
df = pd.util.testing.makeTimeDataFrame(12500) 
p = TimeSeries(df, tools = 'xwheel_zoom,reset') 

當我打開HTML文件,它顯示了整個數據,然後我可以放大,是否有辦法指定當我打開html文件時,它只顯示說去年的數據?

回答

3

的解釋in the docs

這將決定初始變焦可以設置x_range。如果您像文檔中的修改示例一樣縮小數據,其餘數據仍將繪製:

from bokeh.plotting import figure, output_file, show 
from bokeh.models import Range1d 

output_file("title.html") 

# create a new plot with a range set with a tuple 
p = figure(plot_width=400, plot_height=400, x_range=(0, 20)) 

# set a range using a Range1d 
p.y_range = Range1d(0, 15) 

p.circle([1, 2, 3, 4, 5, 25], [2, 5, 8, 2, 7, 50], size=10) 

show(p)