2016-01-31 37 views
0

我有一個值爲每個時間點(每半小時更新一次)。可視化時間序列與散景 - 數據點重疊

我讀了CSV數據到一個大熊貓數據幀:

import pandas as pd 
headers = ['timestamp', 'pressure'] 
df = pd.read_csv('data.csv', header=None, names=headers) 

的數據類型是:

timestamp object 
pressure  int64 

東風本身看起來是這樣的:

   timestamp pressure 
0 2016-01-29 10:00:00   3 
1 2016-01-30 22:30:00   2 
2 2016-01-31 04:30:00   1 

我想象它如下:

fig = TimeSeries(df, x = 'timestamp', y = 'pressure',builder_type='point' 
                ,xscale="datetime") 

以及它的返回是:

enter image description here

但是,如果刪除了部分時間 - 這將很好地工作:

enter image description here

我到底做錯了什麼?

回答

1

嘗試設置webgl = False。

散景0.10中的webgl中存在issue,導致當情節放大時跳躍數據點。它必須處理與渲染有關的舍入錯誤。我懷疑目前的行爲與此有關,而且這些問題還沒有完全解決。

試試這個小例子:

import numpy as np 
import bokeh.plotting as bk 
from datetime import datetime,timedelta 

no_of_datapoints=10 

base = datetime(2016, 2, 1, 9, 36, 0) 
date_list = [base - timedelta(minutes=x) for x in range(0, no_of_datapoints)] 
datapoints=np.arange(no_of_datapoints) 

p=bk.figure(webgl=True,x_axis_type="datetime") 
p.scatter(x=date_list,y=datapoints) 
bk.show(p) 

設置的WebGL =真給圖: incorrect diagram when webgl=True

的WebGL =假給出圖: correct diagram when webgl=False

+0

非常感謝!似乎運作良好。我決定切換到純粹的D3.js :) – Dennis

+0

很高興能夠提供幫助!該行爲已被確認爲[Bokeh團隊的bug](https://github.com/bokeh/bokeh/issues/3795),並被標記爲0.12版本的操作。 – Anadyn