当前位置: 首页>>代码示例>>Python>>正文


Python plotting.show方法代码示例

本文整理汇总了Python中bokeh.plotting.show方法的典型用法代码示例。如果您正苦于以下问题:Python plotting.show方法的具体用法?Python plotting.show怎么用?Python plotting.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bokeh.plotting的用法示例。


在下文中一共展示了plotting.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: show

# 需要导入模块: from bokeh import plotting [as 别名]
# 或者: from bokeh.plotting import show [as 别名]
def show(plot_to_show):
    """Display a plot, either interactive or static.

    Parameters
    ----------
    plot_to_show: Output of a plotting command (matplotlib axis or bokeh figure)
        The plot to show

    Returns
    -------
    None
    """
    if isinstance(plot_to_show, plt.Axes):
        show_static()
    elif isinstance(plot_to_show, bpl.Figure):
        show_interactive(plot_to_show)
    else:
        raise ValueError(
            "The type of ``plot_to_show`` was not valid, or not understood."
        ) 
开发者ID:lmcinnes,项目名称:umap,代码行数:22,代码来源:plot.py

示例2: plot_performance_vs_trials

# 需要导入模块: from bokeh import plotting [as 别名]
# 或者: from bokeh.plotting import show [as 别名]
def plot_performance_vs_trials(results, output_directory, save_file="PerformanceVsTrials.png", plot_title=""):
    try:
        import matplotlib.pyplot as plt
        matplotlib_imported = True
    except ImportError:
        matplotlib_imported = False
    
    if not matplotlib_imported:
        warnings.warn('AutoGluon summary plots cannot be created because matplotlib is not installed. Please do: "pip install matplotlib"')
        return None
    
    ordered_trials = sorted(list(results['trial_info'].keys()))
    ordered_val_perfs = [results['trial_info'][trial_id][results['reward_attr']] for trial_id in ordered_trials]
    x = range(1, len(ordered_trials)+1)
    y = []
    for i in x:
        y.append(max([ordered_val_perfs[j] for j in range(i)])) # best validation performance in trials up until ith one (assuming higher = better)
    fig, ax = plt.subplots()
    ax.plot(x, y)
    ax.set(xlabel='Completed Trials', ylabel='Best Performance', title = plot_title)
    if output_directory is not None:
        outputfile = os.path.join(output_directory, save_file)
        fig.savefig(outputfile)
        print("Plot of HPO performance saved to file: %s" % outputfile)
    plt.show() 
开发者ID:awslabs,项目名称:autogluon,代码行数:27,代码来源:plots.py

示例3: plot_bokeh_history

# 需要导入模块: from bokeh import plotting [as 别名]
# 或者: from bokeh.plotting import show [as 别名]
def plot_bokeh_history(solvers, x, y, x_arrays, y_arrays, mins, legends,
                       log_scale, show):
    import bokeh.plotting as bk

    min_x, max_x, min_y, max_y = mins
    if log_scale:
        # Bokeh has a weird behaviour when using logscale with 0 entries...
        # We use the difference between smallest value of second small
        # to set the range of y
        all_ys = np.hstack(y_arrays)
        y_range_min = np.min(all_ys[all_ys != 0])
        if y_range_min < 0:
            raise ValueError("Cannot plot negative values on a log scale")

        fig = bk.Figure(plot_height=300, y_axis_type="log",
                        y_range=[y_range_min, max_y])
    else:
        fig = bk.Figure(plot_height=300, x_range=[min_x, max_x],
                        y_range=[min_y, max_y])

    for i, (solver, x_array, y_array, legend) in enumerate(
            zip(solvers, x_arrays, y_arrays, legends)):
        color = get_plot_color(i)
        fig.line(x_array, y_array, line_width=3, legend=legend, color=color)
    fig.xaxis.axis_label = x
    fig.yaxis.axis_label = y
    fig.xaxis.axis_label_text_font_size = "12pt"
    fig.yaxis.axis_label_text_font_size = "12pt"
    if show:
        bk.show(fig)
        return None
    else:
        return fig 
开发者ID:X-DataInitiative,项目名称:tick,代码行数:35,代码来源:plot_history.py

示例4: _show

# 需要导入模块: from bokeh import plotting [as 别名]
# 或者: from bokeh.plotting import show [as 别名]
def _show(f):
    if _figures is None:
        if _static_images:
            _show_static_images(f)
        else:
            _process_canvas([])
            _bplt.show(f)
            _process_canvas([f])
    else:
        _figures[-1].append(f) 
开发者ID:org-arl,项目名称:arlpy,代码行数:12,代码来源:plot.py

示例5: __exit__

# 需要导入模块: from bokeh import plotting [as 别名]
# 或者: from bokeh.plotting import show [as 别名]
def __exit__(self, *args):
        global _figures, _figsize
        if len(_figures) > 1 or len(_figures[0]) > 0:
            f = _bplt.gridplot(_figures, merge_tools=False)
            if _static_images:
                _show_static_images(f)
            else:
                _process_canvas([])
                _bplt.show(f)
                _process_canvas([item for sublist in _figures for item in sublist])
        _figures = None
        _figsize = self.ofigsize 
开发者ID:org-arl,项目名称:arlpy,代码行数:14,代码来源:plot.py

示例6: show_layout

# 需要导入模块: from bokeh import plotting [as 别名]
# 或者: from bokeh.plotting import show [as 别名]
def show_layout(ax, show=True, force_layout=False):
    """Create a layout and call bokeh show."""
    if show is None:
        show = rcParams["plot.bokeh.show"]
    if show:
        import bokeh.plotting as bkp

        layout = create_layout(ax, force_layout=force_layout)
        bkp.show(layout) 
开发者ID:arviz-devs,项目名称:arviz,代码行数:11,代码来源:__init__.py

示例7: despline

# 需要导入模块: from bokeh import plotting [as 别名]
# 或者: from bokeh.plotting import show [as 别名]
def despline(ax=None):
    import matplotlib.pyplot as plt

    ax = plt.gca() if ax is None else ax
    # Hide the right and top spines
    ax.spines["right"].set_visible(False)
    ax.spines["top"].set_visible(False)
    # Only show ticks on the left and bottom spines
    ax.yaxis.set_ticks_position("left")
    ax.xaxis.set_ticks_position("bottom") 
开发者ID:aristoteleo,项目名称:dynamo-release,代码行数:12,代码来源:utils.py

示例8: some_activities

# 需要导入模块: from bokeh import plotting [as 别名]
# 或者: from bokeh.plotting import show [as 别名]
def some_activities(constraint):

    f'''
    # Some Activities: {constraint}

    This displays thumbnails of routes that match the query over statistics.  For example,

        Active Distance > 40 & Active Distance < 60

    will show all activities with a distance between 40 and 60 km.
    '''

    '''
    $contents
    '''

    '''
    ## Build Maps
    
    Loop over activities, retrieve data, and construct maps. 
    '''

    s = session('-v2')
    maps = [map_thumbnail(100, 120, data)
            for data in (activity_statistics(s, SPHERICAL_MERCATOR_X, SPHERICAL_MERCATOR_Y,
                                             ACTIVE_DISTANCE, TOTAL_CLIMB,
                                             activity_journal=aj)
                         for aj in constrained_sources(s, constraint))
            if len(data[SPHERICAL_MERCATOR_X].dropna()) > 10]
    print(f'Found {len(maps)} activities')

    '''
    ## Display Maps
    '''

    output_notebook()
    show(htile(maps, 8)) 
开发者ID:andrewcooke,项目名称:choochoo,代码行数:39,代码来源:some_activities.py

示例9: get_jupyter

# 需要导入模块: from bokeh import plotting [as 别名]
# 或者: from bokeh.plotting import show [as 别名]
def get_jupyter(self):
        output_notebook()
        show(self.plot()) 
开发者ID:automl,项目名称:CAVE,代码行数:5,代码来源:cost_over_time.py

示例10: _do_plot_candle_html

# 需要导入模块: from bokeh import plotting [as 别名]
# 或者: from bokeh.plotting import show [as 别名]
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) 
开发者ID:bbfamily,项目名称:abu,代码行数:39,代码来源:ABuMarketDrawing.py

示例11: plot_simple_multi_stock

# 需要导入模块: from bokeh import plotting [as 别名]
# 或者: from bokeh.plotting import show [as 别名]
def plot_simple_multi_stock(multi_kl_pd):
    """
    将多个金融时间序列收盘价格缩放到一个价格水平后,可视化价格变动
    :param multi_kl_pd: 可迭代的序列,元素为金融时间序列
    """
    rg_ret = ABuScalerUtil.scaler_matrix([kl_pd.close for kl_pd in multi_kl_pd])
    for i, kl_pd in enumerate(multi_kl_pd):
        plt.plot(kl_pd.index, rg_ret[i])
    plt.show() 
开发者ID:bbfamily,项目名称:abu,代码行数:11,代码来源:ABuMarketDrawing.py

示例12: plot_simple_two_stock

# 需要导入模块: from bokeh import plotting [as 别名]
# 或者: from bokeh.plotting import show [as 别名]
def plot_simple_two_stock(two_stcok_dict):
    """
    将两个金融时间序列收盘价格缩放到一个价格水平后,可视化价格变动
    :param two_stcok_dict: 字典形式,key将做为lable进行可视化使用,元素为金融时间序列
    """
    if not isinstance(two_stcok_dict, dict) or len(two_stcok_dict) != 2:
        print('two_stcok_dict type must dict! or len(two_stcok_dict) != 2')
        return

    label_arr = [s_name for s_name in two_stcok_dict.keys()]
    x, y = ABuScalerUtil.scaler_xy(two_stcok_dict[label_arr[0]].close, two_stcok_dict[label_arr[1]].close)
    plt.plot(x, label=label_arr[0])
    plt.plot(y, label=label_arr[1])
    plt.legend(loc=2)
    plt.show() 
开发者ID:bbfamily,项目名称:abu,代码行数:17,代码来源:ABuMarketDrawing.py

示例13: readMatLabFig_LandmarkMap

# 需要导入模块: from bokeh import plotting [as 别名]
# 或者: from bokeh.plotting import show [as 别名]
def readMatLabFig_LandmarkMap(LandmarkMap_fn):
    LandmarkMap=loadmat(LandmarkMap_fn, squeeze_me=True, struct_as_record=False)
    y=loadmat(LandmarkMap_fn)
    print(sorted(LandmarkMap.keys()))
        
    LandmarkMap_dic={} #提取.fig值
    for object_idx in range(LandmarkMap['hgS_070000'].children.children.shape[0]):
        # print(object_idx)
        try:
            X=LandmarkMap['hgS_070000'].children.children[object_idx].properties.XData #good
            Y=LandmarkMap['hgS_070000'].children.children[object_idx].properties.YData 
            LandmarkMap_dic[object_idx]=(X,Y)
        except:
            pass
    
    # print(LandmarkMap_dic)
    fig= plt.figure(figsize=(130,20))
    colors=['#7f7f7f','#d62728','#1f77b4','','','']
    markers=['.','+','o','','','']
    dotSizes=[200,3000,3000,0,0,0]
    linewidths=[2,10,10,0,0,0]
    i=0
    for key in LandmarkMap_dic.keys():
        plt.scatter(LandmarkMap_dic[key][1],LandmarkMap_dic[key][0], s=dotSizes[i],marker=markers[i], color=colors[i],linewidth=linewidths[i])
        i+=1
    plt.tick_params(axis='both',labelsize=80)
    plt.show()
    return LandmarkMap_dic

#03-read PHMI values for evaluation of AVs' on-board lidar navigation 读取PHMI值
#the PHMI value less than pow(10,-5) is scaled to show clearly------on; the PHMI value larger than pow(10,-5) is scaled to show clearly------on
#数据类型A 
开发者ID:richieBao,项目名称:python-urbanPlanning,代码行数:34,代码来源:showMatLabFig._spatioTemporal.py

示例14: singleBoxplot

# 需要导入模块: from bokeh import plotting [as 别名]
# 或者: from bokeh.plotting import show [as 别名]
def singleBoxplot(array):
    import plotly.express as px
    import pandas as pd
    df=pd.DataFrame(array,columns=["value"])
    fig = px.box(df, y="value",points="all")
    # fig.show() #show in Jupyter
    import plotly
    plotly.offline.plot (fig) #works in spyder

#04-split curve into continuous parts based on the jumping position 使用1维卷积的方法,在曲线跳变点切分曲线 
开发者ID:richieBao,项目名称:python-urbanPlanning,代码行数:12,代码来源:showMatLabFig._spatioTemporal.py

示例15: location_landmarks_network

# 需要导入模块: from bokeh import plotting [as 别名]
# 或者: from bokeh.plotting import show [as 别名]
def location_landmarks_network(targetPts_idx,locations,landmarks):   
    LMs=np.stack((landmarks[0], landmarks[1]), axis=-1)
    LCs=np.stack((locations[0], locations[1]), axis=-1)
    ptsMerge=np.vstack((LMs,LCs))
    print("LMs shape:%s, LCs shaoe:%s, ptsMerge shape:%s"%(LMs.shape, LCs.shape,ptsMerge.shape))
    targetPts_idx_adj={}
    for key in targetPts_idx.keys():
        targetPts_idx_adj[key+LMs.shape[0]]=targetPts_idx[key]
    edges=[[(key,i) for i in targetPts_idx_adj[key]] for key in targetPts_idx_adj.keys()]
    edges=flatten_lst(edges)
    
    G=nx.Graph()
    G.position={}
    # G.targetPtsNum={}    
    i=0
    for pts in ptsMerge:
        G.add_node(i)
        G.position[i]=(pts[1],pts[0])        
        # G.targetPtsNum[LM]=(len(targetPts[key]))
        i+=1
    
    G.add_edges_from(edges)
    
    plt.figure(figsize=(130,20))
    nx.draw(G,G.position,linewidths=1,edge_color='gray')
    plt.show()
    return G
#网络交互图表 
开发者ID:richieBao,项目名称:python-urbanPlanning,代码行数:30,代码来源:showMatLabFig._spatioTemporal.py


注:本文中的bokeh.plotting.show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。