當前位置: 首頁>>代碼示例>>Python>>正文


Python holoviews.renderer方法代碼示例

本文整理匯總了Python中holoviews.renderer方法的典型用法代碼示例。如果您正苦於以下問題:Python holoviews.renderer方法的具體用法?Python holoviews.renderer怎麽用?Python holoviews.renderer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在holoviews的用法示例。


在下文中一共展示了holoviews.renderer方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: render_function

# 需要導入模塊: import holoviews [as 別名]
# 或者: from holoviews import renderer [as 別名]
def render_function(obj, view):
    """
    The default Renderer function which handles HoloViews objects.
    """
    try:
        import holoviews as hv
    except:
        hv = None

    if hv and isinstance(obj, hv.core.Dimensioned):
        renderer = hv.renderer('bokeh')
        if not view._notebook:
            renderer = renderer.instance(mode='server')
        plot = renderer.get_plot(obj, doc=view._document)
        if view._notebook:
            plot.comm = view._comm
        plot.document = view._document
        return plot.state
    return obj 
開發者ID:ioam,項目名稱:parambokeh,代碼行數:21,代碼來源:view.py

示例2: load_data_plot

# 需要導入模塊: import holoviews [as 別名]
# 或者: from holoviews import renderer [as 別名]
def load_data_plot(renderer, frame_indices, gripper_status, action_status, gripper_action_label, height, width):
    # load the gripper data
    gripper_data = hv.Table({'Gripper': gripper_status, 'Frame': frame_indices},
                            ['Gripper', 'Frame'])
    gripper_curves = gripper_data.to.curve('Frame', 'Gripper')
    gripper_curves = gripper_curves.options(width=width, height=height//4)
    gripper_plot = renderer.get_plot(gripper_curves)

    # load the action data
    action_data = hv.Table({'Action': action_status, 'Frame': frame_indices},
                           ['Action', 'Frame'])
    action_curves = action_data.to.curve('Frame', 'Action')
    action_curves = action_curves.options(width=width, height=height//4)
    action_plot = renderer.get_plot(action_curves)

    # load the gripper action label

    gripper_action_data = hv.Table({'Gripper Action': gripper_action_label, 'Frame': frame_indices},
                           ['Gripper Action', 'Frame'])
    gripper_action_curves = gripper_action_data.to.curve('Frame', 'Gripper Action')
    gripper_action_curves = gripper_action_curves.options(width=width, height=height//4)
    gripper_action_plot = renderer.get_plot(gripper_action_curves)

    return gripper_plot, action_plot, gripper_action_plot 
開發者ID:jhu-lcsr,項目名稱:costar_plan,代碼行數:26,代碼來源:stack_player.py

示例3: _save_to_svg

# 需要導入模塊: import holoviews [as 別名]
# 或者: from holoviews import renderer [as 別名]
def _save_to_svg(hv_obj, save):
    bokeh_obj = hv.renderer('bokeh').get_plot(hv_obj).state
    figures = _get_figures(bokeh_obj)
    for i, figure in enumerate(figures):
        figure.output_backend = 'svg'

        if len(figures) != 1:
            if not os.path.exists(save):
                os.makedirs(save)
            tidied_title = figure.title.text
            save_fp = os.path.join(
                save, '{0}_{1}'.format(tidied_title, i))
        else:
            save_fp = save

        if not save_fp.endswith('svg'):
            save_fp = '{0}.{1}'.format(save_fp, 'svg')

        export_svgs(figure, save_fp) 
開發者ID:DeniseCaiLab,項目名稱:minian,代碼行數:21,代碼來源:visualization.py

示例4: __init__

# 需要導入模塊: import holoviews [as 別名]
# 或者: from holoviews import renderer [as 別名]
def __init__(self, default=None, callback=None, renderer=None, **kwargs):
        self.callbacks = {}
        self.renderer = (render_function if renderer is None else renderer)
        super(_View, self).__init__(default, **kwargs)
        self._comm = None
        self._document = None
        self._notebook = False 
開發者ID:ioam,項目名稱:parambokeh,代碼行數:9,代碼來源:view.py

示例5: __set__

# 需要導入模塊: import holoviews [as 別名]
# 或者: from holoviews import renderer [as 別名]
def __set__(self, obj, val):
        super(_View, self).__set__(obj, val)
        obj_id = id(obj)
        if obj_id in self.callbacks:
            self.callbacks[obj_id](self.renderer(val, self)) 
開發者ID:ioam,項目名稱:parambokeh,代碼行數:7,代碼來源:view.py

示例6: setUp

# 需要導入模塊: import holoviews [as 別名]
# 或者: from holoviews import renderer [as 別名]
def setUp(self):
        try:
            import scipy # noqa
        except:
            raise SkipTest('SciPy not available')
        try:
            import matplotlib # noqa
        except:
            raise SkipTest('SciPy not available')
        self.renderer = hv.renderer('matplotlib')
        np.random.seed(42)
        super(StatisticalCompositorTest, self).setUp() 
開發者ID:holoviz,項目名稱:holoviews,代碼行數:14,代碼來源:teststatselements.py

示例7: hv_bokeh

# 需要導入模塊: import holoviews [as 別名]
# 或者: from holoviews import renderer [as 別名]
def hv_bokeh():
    import holoviews as hv
    hv.renderer('bokeh')
    prev_backend = hv.Store.current_backend
    hv.Store.current_backend = 'bokeh'
    yield
    hv.Store.current_backend = prev_backend 
開發者ID:holoviz,項目名稱:panel,代碼行數:9,代碼來源:conftest.py

示例8: hv_mpl

# 需要導入模塊: import holoviews [as 別名]
# 或者: from holoviews import renderer [as 別名]
def hv_mpl():
    import holoviews as hv
    hv.renderer('matplotlib')
    prev_backend = hv.Store.current_backend
    hv.Store.current_backend = 'matplotlib'
    yield
    hv.Store.current_backend = prev_backend 
開發者ID:holoviz,項目名稱:panel,代碼行數:9,代碼來源:conftest.py

示例9: next_image

# 需要導入模塊: import holoviews [as 別名]
# 或者: from holoviews import renderer [as 別名]
def next_image(files, action):
    global file_textbox, button, button_next, button_prev, index
    print("next clicked")
    file_textbox.value = "Processing..."
    renderer = hv.renderer('bokeh')
    if action == 'next':
        index=(index + 1) % len(files)
    else:
        index=(index - 1) % len(files)
    #print("it ", iterator)
    print("index before check",index)
    index = check_errors(files, index, action)
    print("index after check", index)
    print("len", len(files))

    file_name = files[index]
    rgb_images, frame_indices, gripper_status, action_status, gripper_action_label, gripper_action_goal_idx = process_image(file_name)
    print("image loaded")
    print("action goal idx", gripper_action_goal_idx)
    height = int(rgb_images[0].shape[0])
    width = int(rgb_images[0].shape[1])
    start = 0
    end = len(rgb_images) - 1
    print(' End Index of RGB images: ' + str(end))

    def slider_update(attrname, old, new):
        plot.update(slider.value)

    slider = Slider(start=start, end=end, value=0, step=1, title="Frame", width=width)
    slider.on_change('value', slider_update)

    holomap = generate_holo_map(rgb_images, height, width)
    print("generated holomap")
    plot = renderer.get_plot(holomap)
    print("plot rendered")
    gripper_plot, action_plot, gripper_action_plot = load_data_plot(renderer, frame_indices, gripper_status, action_status, gripper_action_label, height, width)
    print("plot loaded..")
    plot_list = [[plot.state], [gripper_plot.state], [action_plot.state]]

    widget_list = [[slider, button, button_prev, button_next], [file_textbox]]

    # "gripper_action" plot, labels based on the gripper opening and closing
    plot_list.append([gripper_action_plot.state])
    layout_child = layout(plot_list + widget_list, sizing_mode='fixed')
    curdoc().clear()
    file_textbox.value = file_name.split("\\")[-1]
    #curdoc().remove_root(layout_child)
    #layout_root.children[0] = layout_child
    curdoc().add_root(layout_child)

#iterator = iter(file_name_list) 
開發者ID:jhu-lcsr,項目名稱:costar_plan,代碼行數:53,代碼來源:stack_player.py

示例10: next_example

# 需要導入模塊: import holoviews [as 別名]
# 或者: from holoviews import renderer [as 別名]
def next_example(files, action):
    """ load the next example in the dataset
    """
    global file_textbox, button, button_next, button_prev, index, vrep_viz, data, numpy_data
    print("next clicked")
    file_textbox.value = "Processing..."
    renderer = hv.renderer('bokeh')
    if action == 'next':
        index = (index + 1) % len(files)
    else:
        index = (index - 1) % len(files)
    #print("it ", iterator)
    print("index before check", index)
    index = check_errors(files, index, action)
    print("index after check", index)
    print("len", len(files))

    file_name = files[index]
    data, numpy_data = load_example(file_name_list[index])
    rgb_images = numpy_data['rgb_images']
    frame_indices = numpy_data['frame_indices']
    gripper_status = numpy_data['gripper_status']
    action_status = numpy_data['action_status']
    gripper_action_label = numpy_data['gripper_action_label']
    gripper_action_goal_idx = numpy_data['gripper_action_goal_idx']
    print("image loaded")
    print("action goal idx", gripper_action_goal_idx)
    height = int(rgb_images[0].shape[0])
    width = int(rgb_images[0].shape[1])
    start = 0
    end = len(rgb_images)
    print(end)

    def slider_update(attrname, old, new):
        plot.update(slider.value)

    slider = Slider(start=start, end=end, value=0, step=1, title="Frame", width=width)
    slider.on_change('value', slider_update)

    holomap = generate_holo_map(rgb_images, height, width)
    print("generated holomap")
    plot = renderer.get_plot(holomap)
    print("plot rendered")
    gripper_plot, action_plot, gripper_action_plot = load_data_plot(renderer, frame_indices, gripper_status, action_status, gripper_action_label, height, width)
    print("plot loaded..")
    plot_list = [[plot.state], [gripper_plot.state], [action_plot.state]]

    widget_list = [[slider, button, button_prev, button_next], [file_textbox]]

    # "gripper_action" plot, labels based on the gripper opening and closing
    plot_list.append([gripper_action_plot.state])
    layout_child = layout(plot_list + widget_list, sizing_mode='fixed')
    curdoc().clear()
    file_textbox.value = file_name.split("\\")[-1]
    #curdoc().remove_root(layout_child)
    #layout_root.children[0] = layout_child
    curdoc().add_root(layout_child)

#iterator = iter(file_name_list) 
開發者ID:jhu-lcsr,項目名稱:costar_plan,代碼行數:61,代碼來源:vrep_costar_stack.py


注:本文中的holoviews.renderer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。