main.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:EARS 作者: karoldvl 项目源码 文件源码
def plot_detection_last():
    # Horizontal bars with current probabilities
    plt = figure(plot_width=WIDTHS[1], plot_height=HEIGHTS[1],
                 toolbar_location=None, tools='hover',
                 x_range=[0., 1.], y_range=labels[::-1])

    plt.hbar(y='pos', height=0.9, left=0, right='value', color='color', source=DETECTION,
             name='bars', line_color=None)

    # Threshold annotation
    plt.quad(left=-0.1, right='threshold', bottom=-0.1, top=len(labels) + 1, source=THRESHOLD,
             fill_color='#000000', fill_alpha=0.1, line_color='red', line_dash='dashed')

    # X ticks
    plt.xaxis[0].ticker = FixedTicker(ticks=[0, 1])
    plt.xaxis.major_tick_line_color = GRID_COLOR
    plt.xaxis.major_label_text_font_size = '7pt'
    plt.xaxis.major_label_text_font = TEXT_FONT
    plt.xaxis.major_label_text_color = TEXT_COLOR

    # X axis
    plt.xaxis.axis_line_color = None

    # Y ticks
    plt.yaxis[0].ticker = FixedTicker(ticks=np.arange(1, len(labels) + 1, 1).tolist())
    plt.yaxis.major_label_text_font_size = '0pt'
    plt.yaxis.major_tick_line_color = None

    # Y axis
    plt.yaxis.axis_line_color = GRID_COLOR

    # Grid
    plt.xgrid.grid_line_color = None
    plt.ygrid.grid_line_color = None

    # Band fill
    plt.hbar(y=np.arange(1, len(labels) + 1, 2), height=1., left=0, right=1., color='#000000',
             alpha=0.1, level='image', name='bands')

    # Plot fill/border
    plt.outline_line_color = GRID_COLOR
    plt.min_border = 10

    # Plot title
    plt.title.text = 'Current frame:'
    plt.title.text_color = TEXT_COLOR
    plt.title.text_font = TEXT_FONT
    plt.title.text_font_size = '9pt'
    plt.title.text_font_style = 'normal'

    # Hover tools
    hover = plt.select(dict(type=HoverTool))
    hover.names = ['bars']
    hover.tooltips = [
        ('Event', '@label'),
        ('Probability', '@pretty_value'),
    ]

    return plt
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号