2015-07-21 63 views

回答

0

這是當前已知的問題,被列爲0.9.4版的里程碑。檢查出這個線程:https://github.com/bokeh/bokeh/issues/2162

我有一個類似的問題,所以作爲一種解決方法,我已經nan值分割我的範圍,並繪製每個集合單獨。這是基於Bokeh的log scale exampleunutbu's回答於this question

import numpy as np 
from bokeh.plotting import figure, output_file, show 
from bokeh.models import LogAxis, Range1d 

def using_clump(a, b): 
    return [a[s] for s in np.ma.clump_unmasked(np.ma.masked_invalid(b))] 
def main(): 
    x = [0.1, 0.5, 1.0, 1.5, np.nan, 2.0, 2.5, 3.0] 
    y = [10**xx for xx in x] 
    output_file("log.html") 

    p = figure(plot_width=400, plot_height=400, 
      y_axis_type="log", y_range=(10**-1, 10**4)) 

    xdata = using_clump(x, x) 
    ydata = using_clump(y, x) 
    for i in range(0, len(xdata)): 
     p.line(xdata[i], ydata[i], line_width=2) 
     p.circle(xdata[i], ydata[i], fill_color="white", size=8) 

    show(p) 

enter image description here