Python bokeh.plotting.output_file() Examples

The following are 2 code examples of bokeh.plotting.output_file(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module bokeh.plotting , or try the search function .
Example #1
Source File: __init__.py    From arviz with Apache License 2.0 5 votes vote down vote up
def output_file(*args, **kwargs):
    """Wrap bokeh.plotting.output_file."""
    import bokeh.plotting as bkp

    return bkp.output_file(*args, **kwargs) 
Example #2
Source File: ABuMarketDrawing.py    From abu with GNU General Public License v3.0 5 votes vote down vote up
def _do_plot_candle_html(date, p_open, high, low, close, symbol, save):
    """
    bk绘制可交互的k线图
    :param date: 融时间序列交易日时间,pd.DataFrame.index对象
    :param p_open: 金融时间序列开盘价格序列,np.array对象
    :param high: 金融时间序列最高价格序列,np.array对象
    :param low: 金融时间序列最低价格序列,np.array对象
    :param close: 金融时间序列收盘价格序列,np.array对象
    :param symbol: symbol str对象
    :param save: 是否保存可视化结果在本地
    """
    mids = (p_open + close) / 2
    spans = abs(close - p_open)

    inc = close > p_open
    dec = p_open > close

    w = 24 * 60 * 60 * 1000

    t_o_o_l_s = "pan,wheel_zoom,box_zoom,reset,save"

    p = bp.figure(x_axis_type="datetime", tools=t_o_o_l_s, plot_width=1280, title=symbol)
    p.xaxis.major_label_orientation = pi / 4
    p.grid.grid_line_alpha = 0.3

    p.segment(date.to_datetime(), high, date.to_datetime(), low, color="black")
    # noinspection PyUnresolvedReferences
    p.rect(date.to_datetime()[inc], mids[inc], w, spans[inc], fill_color=__colorup__, line_color=__colorup__)
    # noinspection PyUnresolvedReferences
    p.rect(date.to_datetime()[dec], mids[dec], w, spans[dec], fill_color=__colordown__, line_color=__colordown__)

    bp.show(p)
    if save:
        save_dir = os.path.join(K_SAVE_CACHE_HTML_ROOT, ABuDateUtil.current_str_date())
        html_name = os.path.join(save_dir, symbol + ".html")
        ABuFileUtil.ensure_dir(html_name)
        bp.output_file(html_name, title=symbol)