当前位置: 首页>>代码示例>>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;未经允许,请勿转载。