小编Sam*_*haw的帖子

如何加快 Bokeh 中创建的绘图的页面加载速度?

运行代码后,页面打开,空白页面显示 13 秒,之后出现预期的绘图。

有没有办法加快这个速度?(13 秒,对于用户来说太长了)

该代码生成 44 个图,分为两列(2n 个循环),按参数不同(第一个循环),然后按工具名称不同(第 3 个循环)

另外,如果 bokeh 不是合适的工具,我会很高兴听到一种绘制交互式图的方法,最好使用 python

这是代码:

dateparse = lambda x: pd.datetime.strptime(x, '%Y-%m-%dT%H:%M:%S')

df = pd.read_csv("LUSU.csv",parse_dates=['PM_START_DATE'], date_parser=dateparse)

df.head()
print("time elapsed: {:.2f}s".format(time.time() - start_time))
x = df['PM_START_DATE']
y = df['TASK_VALUE']
tool=df['ENTITY']
tool_list=df['ENTITY'].unique()
param_list=df['PARAMETER'].unique()
#
print("time elapsed: {:.2f}s".format(time.time() - start_time))
colors = itertools.cycle(Spectral11)
output_file('LUSU.html', mode="cdn")
for i in range(0,44,2):
    row = []
    for _ in range(2):
        p = figure(title=param_list[i], x_axis_label='date', y_axis_label='chart value', x_axis_type="datetime", toolbar_location="below")
        for j in range(len(tool_list)):
            df1=((df['PARAMETER']==param_list[i] )& (df['ENTITY']==tool_list[j] ))
            source …
Run Code Online (Sandbox Code Playgroud)

python plot interactive python-3.x bokeh

5
推荐指数
1
解决办法
2155
查看次数

标签 统计

bokeh ×1

interactive ×1

plot ×1

python ×1

python-3.x ×1