Python holoviews.renderer() Examples
The following are 11
code examples of holoviews.renderer().
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
holoviews
, or try the search function
.
Example #1
Source File: view.py From parambokeh with BSD 3-Clause "New" or "Revised" License | 6 votes |
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
Example #2
Source File: stack_player.py From costar_plan with Apache License 2.0 | 6 votes |
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
Example #3
Source File: vrep_costar_stack.py From costar_plan with Apache License 2.0 | 6 votes |
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
Example #4
Source File: visualization.py From minian with GNU General Public License v3.0 | 6 votes |
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)
Example #5
Source File: view.py From parambokeh with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #6
Source File: view.py From parambokeh with BSD 3-Clause "New" or "Revised" License | 5 votes |
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))
Example #7
Source File: teststatselements.py From holoviews with BSD 3-Clause "New" or "Revised" License | 5 votes |
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()
Example #8
Source File: conftest.py From panel with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #9
Source File: conftest.py From panel with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #10
Source File: stack_player.py From costar_plan with Apache License 2.0 | 4 votes |
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)
Example #11
Source File: vrep_costar_stack.py From costar_plan with Apache License 2.0 | 4 votes |
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)