panel.vtk Package#


vtk Package#


enums Module#

Inheritance diagram of panel.pane.vtk.enums
class panel.pane.vtk.enums.TextPosition(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum


synchronizable_deserializer Module#

panel.pane.vtk.synchronizable_deserializer.capitalize(name)[source]#

Upper the first letter letting the rest unchange


synchronizable_serializer Module#

Inheritance diagram of panel.pane.vtk.synchronizable_serializer

vtk Module#

Inheritance diagram of panel.pane.vtk.vtk

Defines a VTKPane which renders a vtk plot using VTKPlot bokeh model.

class panel.pane.vtk.vtk.AbstractVTK(object=None, **params)[source]#

Bases: PaneBase

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

axes = param.Dict(allow_refs=False, class_=<class β€˜dict’>, default={}, label=’Axes’, nested_refs=True, rx=<param.reactive.reactive_ops object at 0x166e0f890>)

Parameters of the axes to construct in the 3d view. Must contain at least xticker, yticker and zticker. A ticker is a dictionary which contains: - ticks (array of numbers) - required. Positions in the scene coordinates of the corresponding axis’ ticks. - labels (array of strings) - optional. Label displayed respectively to the ticks positions. If labels are not defined they are inferred from the ticks array. - digits: number of decimal digits when ticks are converted to labels. - fontsize: size in pts of the ticks labels. - show_grid: boolean. If true (default) the axes grid is visible. - grid_opacity: float between 0-1. Defines the grid opacity. - axes_opacity: float between 0-1. Defines the axes lines opacity.

camera = param.Dict(allow_None=True, allow_refs=False, class_=<class β€˜dict’>, label=’Camera’, nested_refs=True, rx=<param.reactive.reactive_ops object at 0x15e0f3450>)

State of the rendered VTK camera.

color_mappers = param.List(allow_refs=False, bounds=(0, None), default=[], label=’Color mappers’, nested_refs=True, rx=<param.reactive.reactive_ops object at 0x166ebd190>)

Color mapper of the actor in the scene

orientation_widget = param.Boolean(allow_refs=False, default=False, label=’Orientation widget’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15e0f2cd0>)

Activate/Deactivate the orientation widget display.

interactive_orientation_widget = param.Boolean(allow_refs=False, constant=True, default=True, label=’Interactive orientation widget’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15e88bf10>)

classmethod applies(obj: Any) β†’ float | bool | None[source]#

Returns boolean or float indicating whether the Pane can render the object.

If the priority of the pane is set to None, this method may also be used to define a float priority depending on the object being rendered.

clone(object: Optional[Any] = None, **params) β†’ T[source]#

Makes a copy of the Pane sharing the same parameters.

Parameters:
  • object (Optional new object to render) –

  • params (Keyword arguments override the parameters on the clone.) –

Return type:

Cloned Pane object

controls(parameters: List[str] = [], jslink: bool = True, **kwargs) β†’ Panel[source]#

Creates a set of widgets which allow manipulating the parameters on this instance. By default all parameters which support linking are exposed, but an explicit list of parameters can be provided.

Parameters:
  • parameters (list(str)) – An explicit list of parameters to return controls for.

  • jslink (bool) – Whether to use jslinks instead of Python based links. This does not allow using all types of parameters.

  • kwargs (dict) – Additional kwargs to pass to the Param pane(s) used to generate the controls widgets.

Return type:

A layout of the controls

default_layout[source]#

alias of Row

embed(max_states: int = 1000, max_opts: int = 3, json: bool = False, json_prefix: str = '', save_path: str = './', load_path: Optional[str] = None, progress: bool = False, states={}) β†’ None[source]#

Renders a static version of a panel in a notebook by evaluating the set of states defined by the widgets in the model. Note this will only work well for simple apps with a relatively small state space.

Parameters:
  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for JSON filename

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=False)) – Whether to report progress

  • states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

classmethod get_pane_type(obj: Any, **kwargs) β†’ Type[PaneBase][source]#

Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.

Parameters:

(object) (obj) –

Return type:

The applicable Pane type with the highest precedence.

get_root(doc: Optional[Document] = None, comm: Comm | None = None, preprocess: bool = True) β†’ Model[source]#

Returns the root model and applies pre-processing hooks

Parameters:
  • doc (bokeh.document.Document) – Optional Bokeh document the bokeh model will be attached to.

  • comm (pyviz_comms.Comm) – Optional pyviz_comms when working in notebook

  • preprocess (bool (default=True)) – Whether to run preprocessing hooks

Return type:

Returns the bokeh model corresponding to this panel object

jscallback(args: Dict[str, Any] = {}, **callbacks: str) β†’ Callback[source]#

Allows defining a JS callback to be triggered when a property changes on the source object. The keyword arguments define the properties that trigger a callback and the JS code that gets executed.

Parameters:
  • args (dict) – A mapping of objects to make available to the JS callback

  • **callbacks (dict) – A mapping between properties on the source model and the code to execute when that property changes

Returns:

callback – The Callback which can be used to disable the callback.

Return type:

Callback

Links properties on the this Reactive object to those on the target Reactive object in JS code.

Supports two modes, either specify a mapping between the source and target model properties as keywords or provide a dictionary of JS code snippets which maps from the source parameter to a JS code snippet which is executed when the property changes.

Parameters:
  • target (panel.viewable.Viewable | bokeh.model.Model | holoviews.core.dimension.Dimensioned) – The target to link the value to.

  • code (dict) – Custom code which will be executed when the widget value changes.

  • args (dict) – A mapping of objects to make available to the JS callback

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – A mapping between properties on the source model and the target model property to link it to.

Returns:

link – The GenericLink which can be used unlink the widget and the target model.

Return type:

GenericLink

Links the parameters on this Reactive object to attributes on the target Parameterized object.

Supports two modes, either specify a mapping between the source and target object parameters as keywords or provide a dictionary of callbacks which maps from the source parameter to a callback which is triggered when the parameter changes.

Parameters:
  • target (param.Parameterized) – The target object of the link.

  • callbacks (dict | None) – Maps from a parameter in the source object to a callback.

  • bidirectional (bool) – Whether to link source and target bi-directionally

  • **links (dict) – Maps between parameters on this object to the parameters on the supplied object.

save(filename: str | os.PathLike | IO, title: Optional[str] = None, resources: bokeh.resources.Resources | None = None, template: str | jinja2.environment.Template | None = None, template_variables: Dict[str, Any] = {}, embed: bool = False, max_states: int = 1000, max_opts: int = 3, embed_json: bool = False, json_prefix: str = '', save_path: str = './', load_path: Optional[str] = None, progress: bool = True, embed_states: Dict[Any, Any] = {}, as_png: bool | None = None, **kwargs) β†’ None[source]#

Saves Panel objects to file.

Parameters:
  • filename (str or file-like object) – Filename to save the plot to

  • title (string) – Optional title for the plot

  • resources (bokeh resources) – One of the valid bokeh.resources (e.g. CDN or INLINE)

  • template – passed to underlying io.save

  • template_variables – passed to underlying io.save

  • embed (bool) – Whether the state space should be embedded in the saved file.

  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • embed_json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for the auto-generated json directory

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=True)) – Whether to report progress

  • embed_states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

  • as_png (boolean (default=None)) – To save as a .png. If None save_png will be true if filename is string and ends with png.

select(selector: Optional[Union[type, Callable[[Viewable], bool]]] = None) β†’ List[Viewable][source]#

Iterates over the Viewable and any potential children in the applying the Selector.

Parameters:

selector (type or callable or None) – The selector allows selecting a subset of Viewables by declaring a type or callable function to filter by.

Returns:

viewables

Return type:

list(Viewable)

servable(title: Optional[str] = None, location: bool | 'Location' = True, area: str = 'main', target: Optional[str] = None) β†’ ServableMixin[source]#

Serves the object or adds it to the configured pn.state.template if in a panel serve context, writes to the DOM if in a pyodide context and returns the Panel object to allow it to display itself in a notebook context.

Parameters:
  • title (str) – A string title to give the Document (if served as an app)

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

  • area (str (deprecated)) – The area of a template to add the component too. Only has an effect if pn.config.template has been set.

  • target (str) – Target area to write to. If a template has been configured on pn.config.template this refers to the target area in the template while in pyodide this refers to the ID of the DOM node to write to.

Return type:

The Panel object itself

server_doc(doc: Optional[Document] = None, title: Optional[str] = None, location: bool | 'Location' = True) β†’ Document[source]#

Returns a serveable bokeh Document with the panel attached

Parameters:
  • doc (bokeh.Document (optional)) – The bokeh Document to attach the panel to as a root, defaults to bokeh.io.curdoc()

  • title (str) – A string title to give the Document

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns:

doc – The bokeh document the panel was attached to

Return type:

bokeh.Document

show(title: Optional[str] = None, port: int = 0, address: Optional[str] = None, websocket_origin: Optional[str] = None, threaded: bool = False, verbose: bool = True, open: bool = True, location: bool | 'Location' = True, **kwargs) β†’ StoppableThread' | 'Server[source]#

Starts a Bokeh server and displays the Viewable in a new tab.

Parameters:
  • title (str | None) – A string title to give the Document (if served as an app)

  • port (int (optional, default=0)) – Allows specifying a specific port

  • address (str) – The address the server should listen on for HTTP requests.

  • websocket_origin (str or list(str) (optional)) – A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, β€œlocalhost” is used.

  • threaded (boolean (optional, default=False)) – Whether to launch the Server on a separate thread, allowing interactive use.

  • verbose (boolean (optional, default=True)) – Whether to print the address and port

  • open (boolean (optional, default=True)) – Whether to open the server in a new browser tab

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns:

server – Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)

Return type:

bokeh.server.Server or panel.io.server.StoppableThread

class panel.pane.vtk.vtk.BaseVTKRenderWindow(object, **params)[source]#

Bases: AbstractVTK

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

panel.pane.vtk.vtk.AbstractVTK: axes, camera, color_mappers, orientation_widget, interactive_orientation_widget

enable_keybindings = param.Boolean(allow_refs=False, default=False, label=’Enable keybindings’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15e702910>)

Activate/Deactivate keys binding. Warning: These keys bind may not work as expected in a notebook context if they interact with already binded keys

serialize_on_instantiation = param.Boolean(allow_refs=False, constant=True, default=False, label=’Serialize on instantiation’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x1651de1d0>)

defines when the serialization of the vtkRenderWindow scene occurs. If set to True the scene object is serialized when the pane is created else (default) when the panel is displayed to the screen. This parameter is constant, once set it can’t be modified. Warning: when the serialization occurs at instantiation, the vtkRenderWindow and the view are not fully synchronized. The view displays the state of the scene captured when the panel was created, if elements where added or removed between the instantiation and the display these changes will not be reflected. Moreover when the pane object is updated (replaced or call to param.trigger(β€˜object’)), all the scene is rebuilt from scratch.

serialize_all_data_arrays = param.Boolean(allow_refs=False, constant=True, default=False, label=’Serialize all data arrays’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15e702910>)

If true, enable the serialization of all data arrays of vtkDataSets (point data, cell data and field data). By default the value is False and only active scalars of each dataset are serialized and transfer to the javascript side. Enabling this option will increase memory and network transfer volume but results in more reactive visualizations by using some custom javascript functions.

classmethod applies(obj, **kwargs)[source]#

Returns boolean or float indicating whether the Pane can render the object.

If the priority of the pane is set to None, this method may also be used to define a float priority depending on the object being rendered.

clone(object: Optional[Any] = None, **params) β†’ T[source]#

Makes a copy of the Pane sharing the same parameters.

Parameters:
  • object (Optional new object to render) –

  • params (Keyword arguments override the parameters on the clone.) –

Return type:

Cloned Pane object

controls(parameters: List[str] = [], jslink: bool = True, **kwargs) β†’ Panel[source]#

Creates a set of widgets which allow manipulating the parameters on this instance. By default all parameters which support linking are exposed, but an explicit list of parameters can be provided.

Parameters:
  • parameters (list(str)) – An explicit list of parameters to return controls for.

  • jslink (bool) – Whether to use jslinks instead of Python based links. This does not allow using all types of parameters.

  • kwargs (dict) – Additional kwargs to pass to the Param pane(s) used to generate the controls widgets.

Return type:

A layout of the controls

default_layout[source]#

alias of Row

embed(max_states: int = 1000, max_opts: int = 3, json: bool = False, json_prefix: str = '', save_path: str = './', load_path: Optional[str] = None, progress: bool = False, states={}) β†’ None[source]#

Renders a static version of a panel in a notebook by evaluating the set of states defined by the widgets in the model. Note this will only work well for simple apps with a relatively small state space.

Parameters:
  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for JSON filename

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=False)) – Whether to report progress

  • states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

classmethod get_pane_type(obj: Any, **kwargs) β†’ Type[PaneBase][source]#

Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.

Parameters:

(object) (obj) –

Return type:

The applicable Pane type with the highest precedence.

get_renderer()[source]#

Get the vtk Renderer associated to this pane

get_root(doc: Optional[Document] = None, comm: Comm | None = None, preprocess: bool = True) β†’ Model[source]#

Returns the root model and applies pre-processing hooks

Parameters:
  • doc (bokeh.document.Document) – Optional Bokeh document the bokeh model will be attached to.

  • comm (pyviz_comms.Comm) – Optional pyviz_comms when working in notebook

  • preprocess (bool (default=True)) – Whether to run preprocessing hooks

Return type:

Returns the bokeh model corresponding to this panel object

jscallback(args: Dict[str, Any] = {}, **callbacks: str) β†’ Callback[source]#

Allows defining a JS callback to be triggered when a property changes on the source object. The keyword arguments define the properties that trigger a callback and the JS code that gets executed.

Parameters:
  • args (dict) – A mapping of objects to make available to the JS callback

  • **callbacks (dict) – A mapping between properties on the source model and the code to execute when that property changes

Returns:

callback – The Callback which can be used to disable the callback.

Return type:

Callback

Links properties on the this Reactive object to those on the target Reactive object in JS code.

Supports two modes, either specify a mapping between the source and target model properties as keywords or provide a dictionary of JS code snippets which maps from the source parameter to a JS code snippet which is executed when the property changes.

Parameters:
  • target (panel.viewable.Viewable | bokeh.model.Model | holoviews.core.dimension.Dimensioned) – The target to link the value to.

  • code (dict) – Custom code which will be executed when the widget value changes.

  • args (dict) – A mapping of objects to make available to the JS callback

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – A mapping between properties on the source model and the target model property to link it to.

Returns:

link – The GenericLink which can be used unlink the widget and the target model.

Return type:

GenericLink

Links the parameters on this Reactive object to attributes on the target Parameterized object.

Supports two modes, either specify a mapping between the source and target object parameters as keywords or provide a dictionary of callbacks which maps from the source parameter to a callback which is triggered when the parameter changes.

Parameters:
  • target (param.Parameterized) – The target object of the link.

  • callbacks (dict | None) – Maps from a parameter in the source object to a callback.

  • bidirectional (bool) – Whether to link source and target bi-directionally

  • **links (dict) – Maps between parameters on this object to the parameters on the supplied object.

save(filename: str | os.PathLike | IO, title: Optional[str] = None, resources: bokeh.resources.Resources | None = None, template: str | jinja2.environment.Template | None = None, template_variables: Dict[str, Any] = {}, embed: bool = False, max_states: int = 1000, max_opts: int = 3, embed_json: bool = False, json_prefix: str = '', save_path: str = './', load_path: Optional[str] = None, progress: bool = True, embed_states: Dict[Any, Any] = {}, as_png: bool | None = None, **kwargs) β†’ None[source]#

Saves Panel objects to file.

Parameters:
  • filename (str or file-like object) – Filename to save the plot to

  • title (string) – Optional title for the plot

  • resources (bokeh resources) – One of the valid bokeh.resources (e.g. CDN or INLINE)

  • template – passed to underlying io.save

  • template_variables – passed to underlying io.save

  • embed (bool) – Whether the state space should be embedded in the saved file.

  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • embed_json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for the auto-generated json directory

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=True)) – Whether to report progress

  • embed_states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

  • as_png (boolean (default=None)) – To save as a .png. If None save_png will be true if filename is string and ends with png.

select(selector: Optional[Union[type, Callable[[Viewable], bool]]] = None) β†’ List[Viewable][source]#

Iterates over the Viewable and any potential children in the applying the Selector.

Parameters:

selector (type or callable or None) – The selector allows selecting a subset of Viewables by declaring a type or callable function to filter by.

Returns:

viewables

Return type:

list(Viewable)

servable(title: Optional[str] = None, location: bool | 'Location' = True, area: str = 'main', target: Optional[str] = None) β†’ ServableMixin[source]#

Serves the object or adds it to the configured pn.state.template if in a panel serve context, writes to the DOM if in a pyodide context and returns the Panel object to allow it to display itself in a notebook context.

Parameters:
  • title (str) – A string title to give the Document (if served as an app)

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

  • area (str (deprecated)) – The area of a template to add the component too. Only has an effect if pn.config.template has been set.

  • target (str) – Target area to write to. If a template has been configured on pn.config.template this refers to the target area in the template while in pyodide this refers to the ID of the DOM node to write to.

Return type:

The Panel object itself

server_doc(doc: Optional[Document] = None, title: Optional[str] = None, location: bool | 'Location' = True) β†’ Document[source]#

Returns a serveable bokeh Document with the panel attached

Parameters:
  • doc (bokeh.Document (optional)) – The bokeh Document to attach the panel to as a root, defaults to bokeh.io.curdoc()

  • title (str) – A string title to give the Document

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns:

doc – The bokeh document the panel was attached to

Return type:

bokeh.Document

show(title: Optional[str] = None, port: int = 0, address: Optional[str] = None, websocket_origin: Optional[str] = None, threaded: bool = False, verbose: bool = True, open: bool = True, location: bool | 'Location' = True, **kwargs) β†’ StoppableThread' | 'Server[source]#

Starts a Bokeh server and displays the Viewable in a new tab.

Parameters:
  • title (str | None) – A string title to give the Document (if served as an app)

  • port (int (optional, default=0)) – Allows specifying a specific port

  • address (str) – The address the server should listen on for HTTP requests.

  • websocket_origin (str or list(str) (optional)) – A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, β€œlocalhost” is used.

  • threaded (boolean (optional, default=False)) – Whether to launch the Server on a separate thread, allowing interactive use.

  • verbose (boolean (optional, default=True)) – Whether to print the address and port

  • open (boolean (optional, default=True)) – Whether to open the server in a new browser tab

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns:

server – Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)

Return type:

bokeh.server.Server or panel.io.server.StoppableThread

class panel.pane.vtk.vtk.SyncHelpers[source]#

Bases: object

Class containing helpers functions to update vtkRenderingWindow

add_actors(actors)[source]#

Add a list of actors to the VTK renderer if reset_camera is True, the current camera and it’s clipping will be reset.

remove_actors(actors)[source]#

Add a list of actors to the VTK renderer if reset_camera is True, the current camera and it’s clipping will be reset.

abstract reset_camera()[source]#

Reset the camera

abstract synchronize()[source]#

function to synchronize the renderer with the view

class panel.pane.vtk.vtk.VTK(obj, **params)[source]#

Bases: object

The VTK pane renders a VTK scene inside a panel, making it possible to interact with complex geometries in 3D.

Reference: https://panel.holoviz.org/reference/panes/VTK.html

Example:

>>> pn.extension('vtk')
>>> VTK(some_vtk_object, width=500, height=500)

This is a Class factory and allows to switch between VTKJS, VTKRenderWindow, and VTKRenderWindowSynchronized pane as a function of the object type and when the serialisation of the vtkRenderWindow occurs.

Once a pane is returned by this class (inst = VTK(object)), one can use pn.help(inst) to see parameters available for the current pane

class panel.pane.vtk.vtk.VTKJS(object=None, **params)[source]#

Bases: AbstractVTK

The VTKJS pane allow rendering a vtk scene stored in a vtkjs.

Reference: https://panel.holoviz.org/reference/panes/VTKJS.html

Example:

>>> pn.extension('vtk')
>>> VTK(
...    'https://raw.githubusercontent.com/Kitware/vtk-js/master/Data/StanfordDragon.vtkjs',
...     sizing_mode='stretch_width', height=400, enable_keybindings=True,
...     orientation_widget=True
... )

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

panel.pane.vtk.vtk.AbstractVTK: axes, camera, color_mappers, orientation_widget, interactive_orientation_widget

enable_keybindings = param.Boolean(allow_refs=False, default=False, label=’Enable keybindings’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x165978050>)

Activate/Deactivate keys binding. Warning: These keybindings may not work as expected in a notebook context if they interact with already bound keys.

classmethod applies(obj: Any) β†’ float | bool | None[source]#

Returns boolean or float indicating whether the Pane can render the object.

If the priority of the pane is set to None, this method may also be used to define a float priority depending on the object being rendered.

clone(object: Optional[Any] = None, **params) β†’ T[source]#

Makes a copy of the Pane sharing the same parameters.

Parameters:
  • object (Optional new object to render) –

  • params (Keyword arguments override the parameters on the clone.) –

Return type:

Cloned Pane object

controls(parameters: List[str] = [], jslink: bool = True, **kwargs) β†’ Panel[source]#

Creates a set of widgets which allow manipulating the parameters on this instance. By default all parameters which support linking are exposed, but an explicit list of parameters can be provided.

Parameters:
  • parameters (list(str)) – An explicit list of parameters to return controls for.

  • jslink (bool) – Whether to use jslinks instead of Python based links. This does not allow using all types of parameters.

  • kwargs (dict) – Additional kwargs to pass to the Param pane(s) used to generate the controls widgets.

Return type:

A layout of the controls

default_layout[source]#

alias of Row

embed(max_states: int = 1000, max_opts: int = 3, json: bool = False, json_prefix: str = '', save_path: str = './', load_path: Optional[str] = None, progress: bool = False, states={}) β†’ None[source]#

Renders a static version of a panel in a notebook by evaluating the set of states defined by the widgets in the model. Note this will only work well for simple apps with a relatively small state space.

Parameters:
  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for JSON filename

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=False)) – Whether to report progress

  • states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

export_vtkjs(filename: str | IO = 'vtk_panel.vtkjs')[source]#

Exports current VTK data to .vtkjs file.

Parameters:

filename (str | IO) –

classmethod get_pane_type(obj: Any, **kwargs) β†’ Type[PaneBase][source]#

Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.

Parameters:

(object) (obj) –

Return type:

The applicable Pane type with the highest precedence.

get_root(doc: Optional[Document] = None, comm: Comm | None = None, preprocess: bool = True) β†’ Model[source]#

Returns the root model and applies pre-processing hooks

Parameters:
  • doc (bokeh.document.Document) – Optional Bokeh document the bokeh model will be attached to.

  • comm (pyviz_comms.Comm) – Optional pyviz_comms when working in notebook

  • preprocess (bool (default=True)) – Whether to run preprocessing hooks

Return type:

Returns the bokeh model corresponding to this panel object

jscallback(args: Dict[str, Any] = {}, **callbacks: str) β†’ Callback[source]#

Allows defining a JS callback to be triggered when a property changes on the source object. The keyword arguments define the properties that trigger a callback and the JS code that gets executed.

Parameters:
  • args (dict) – A mapping of objects to make available to the JS callback

  • **callbacks (dict) – A mapping between properties on the source model and the code to execute when that property changes

Returns:

callback – The Callback which can be used to disable the callback.

Return type:

Callback

Links properties on the this Reactive object to those on the target Reactive object in JS code.

Supports two modes, either specify a mapping between the source and target model properties as keywords or provide a dictionary of JS code snippets which maps from the source parameter to a JS code snippet which is executed when the property changes.

Parameters:
  • target (panel.viewable.Viewable | bokeh.model.Model | holoviews.core.dimension.Dimensioned) – The target to link the value to.

  • code (dict) – Custom code which will be executed when the widget value changes.

  • args (dict) – A mapping of objects to make available to the JS callback

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – A mapping between properties on the source model and the target model property to link it to.

Returns:

link – The GenericLink which can be used unlink the widget and the target model.

Return type:

GenericLink

Links the parameters on this Reactive object to attributes on the target Parameterized object.

Supports two modes, either specify a mapping between the source and target object parameters as keywords or provide a dictionary of callbacks which maps from the source parameter to a callback which is triggered when the parameter changes.

Parameters:
  • target (param.Parameterized) – The target object of the link.

  • callbacks (dict | None) – Maps from a parameter in the source object to a callback.

  • bidirectional (bool) – Whether to link source and target bi-directionally

  • **links (dict) – Maps between parameters on this object to the parameters on the supplied object.

save(filename: str | os.PathLike | IO, title: Optional[str] = None, resources: bokeh.resources.Resources | None = None, template: str | jinja2.environment.Template | None = None, template_variables: Dict[str, Any] = {}, embed: bool = False, max_states: int = 1000, max_opts: int = 3, embed_json: bool = False, json_prefix: str = '', save_path: str = './', load_path: Optional[str] = None, progress: bool = True, embed_states: Dict[Any, Any] = {}, as_png: bool | None = None, **kwargs) β†’ None[source]#

Saves Panel objects to file.

Parameters:
  • filename (str or file-like object) – Filename to save the plot to

  • title (string) – Optional title for the plot

  • resources (bokeh resources) – One of the valid bokeh.resources (e.g. CDN or INLINE)

  • template – passed to underlying io.save

  • template_variables – passed to underlying io.save

  • embed (bool) – Whether the state space should be embedded in the saved file.

  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • embed_json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for the auto-generated json directory

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=True)) – Whether to report progress

  • embed_states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

  • as_png (boolean (default=None)) – To save as a .png. If None save_png will be true if filename is string and ends with png.

select(selector: Optional[Union[type, Callable[[Viewable], bool]]] = None) β†’ List[Viewable][source]#

Iterates over the Viewable and any potential children in the applying the Selector.

Parameters:

selector (type or callable or None) – The selector allows selecting a subset of Viewables by declaring a type or callable function to filter by.

Returns:

viewables

Return type:

list(Viewable)

servable(title: Optional[str] = None, location: bool | 'Location' = True, area: str = 'main', target: Optional[str] = None) β†’ ServableMixin[source]#

Serves the object or adds it to the configured pn.state.template if in a panel serve context, writes to the DOM if in a pyodide context and returns the Panel object to allow it to display itself in a notebook context.

Parameters:
  • title (str) – A string title to give the Document (if served as an app)

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

  • area (str (deprecated)) – The area of a template to add the component too. Only has an effect if pn.config.template has been set.

  • target (str) – Target area to write to. If a template has been configured on pn.config.template this refers to the target area in the template while in pyodide this refers to the ID of the DOM node to write to.

Return type:

The Panel object itself

server_doc(doc: Optional[Document] = None, title: Optional[str] = None, location: bool | 'Location' = True) β†’ Document[source]#

Returns a serveable bokeh Document with the panel attached

Parameters:
  • doc (bokeh.Document (optional)) – The bokeh Document to attach the panel to as a root, defaults to bokeh.io.curdoc()

  • title (str) – A string title to give the Document

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns:

doc – The bokeh document the panel was attached to

Return type:

bokeh.Document

show(title: Optional[str] = None, port: int = 0, address: Optional[str] = None, websocket_origin: Optional[str] = None, threaded: bool = False, verbose: bool = True, open: bool = True, location: bool | 'Location' = True, **kwargs) β†’ StoppableThread' | 'Server[source]#

Starts a Bokeh server and displays the Viewable in a new tab.

Parameters:
  • title (str | None) – A string title to give the Document (if served as an app)

  • port (int (optional, default=0)) – Allows specifying a specific port

  • address (str) – The address the server should listen on for HTTP requests.

  • websocket_origin (str or list(str) (optional)) – A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, β€œlocalhost” is used.

  • threaded (boolean (optional, default=False)) – Whether to launch the Server on a separate thread, allowing interactive use.

  • verbose (boolean (optional, default=True)) – Whether to print the address and port

  • open (boolean (optional, default=True)) – Whether to open the server in a new browser tab

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns:

server – Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)

Return type:

bokeh.server.Server or panel.io.server.StoppableThread

class panel.pane.vtk.vtk.VTKRenderWindow(object=None, **params)[source]#

Bases: BaseVTKRenderWindow

VTK panes allow rendering vtkRenderWindow objects. Capture the scene of the vtkRenderWindow passed at instantiation To update the display a new vtkRenderWindow must be passed as object

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

panel.pane.vtk.vtk.AbstractVTK: axes, camera, color_mappers, orientation_widget, interactive_orientation_widget

panel.pane.vtk.vtk.BaseVTKRenderWindow: enable_keybindings, serialize_on_instantiation, serialize_all_data_arrays

classmethod applies(obj, **kwargs)[source]#

Returns boolean or float indicating whether the Pane can render the object.

If the priority of the pane is set to None, this method may also be used to define a float priority depending on the object being rendered.

clone(object: Optional[Any] = None, **params) β†’ T[source]#

Makes a copy of the Pane sharing the same parameters.

Parameters:
  • object (Optional new object to render) –

  • params (Keyword arguments override the parameters on the clone.) –

Return type:

Cloned Pane object

controls(parameters: List[str] = [], jslink: bool = True, **kwargs) β†’ Panel[source]#

Creates a set of widgets which allow manipulating the parameters on this instance. By default all parameters which support linking are exposed, but an explicit list of parameters can be provided.

Parameters:
  • parameters (list(str)) – An explicit list of parameters to return controls for.

  • jslink (bool) – Whether to use jslinks instead of Python based links. This does not allow using all types of parameters.

  • kwargs (dict) – Additional kwargs to pass to the Param pane(s) used to generate the controls widgets.

Return type:

A layout of the controls

default_layout[source]#

alias of Row

embed(max_states: int = 1000, max_opts: int = 3, json: bool = False, json_prefix: str = '', save_path: str = './', load_path: Optional[str] = None, progress: bool = False, states={}) β†’ None[source]#

Renders a static version of a panel in a notebook by evaluating the set of states defined by the widgets in the model. Note this will only work well for simple apps with a relatively small state space.

Parameters:
  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for JSON filename

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=False)) – Whether to report progress

  • states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

classmethod get_pane_type(obj: Any, **kwargs) β†’ Type[PaneBase][source]#

Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.

Parameters:

(object) (obj) –

Return type:

The applicable Pane type with the highest precedence.

get_renderer()[source]#

Get the vtk Renderer associated to this pane

get_root(doc: Optional[Document] = None, comm: Comm | None = None, preprocess: bool = True) β†’ Model[source]#

Returns the root model and applies pre-processing hooks

Parameters:
  • doc (bokeh.document.Document) – Optional Bokeh document the bokeh model will be attached to.

  • comm (pyviz_comms.Comm) – Optional pyviz_comms when working in notebook

  • preprocess (bool (default=True)) – Whether to run preprocessing hooks

Return type:

Returns the bokeh model corresponding to this panel object

jscallback(args: Dict[str, Any] = {}, **callbacks: str) β†’ Callback[source]#

Allows defining a JS callback to be triggered when a property changes on the source object. The keyword arguments define the properties that trigger a callback and the JS code that gets executed.

Parameters:
  • args (dict) – A mapping of objects to make available to the JS callback

  • **callbacks (dict) – A mapping between properties on the source model and the code to execute when that property changes

Returns:

callback – The Callback which can be used to disable the callback.

Return type:

Callback

Links properties on the this Reactive object to those on the target Reactive object in JS code.

Supports two modes, either specify a mapping between the source and target model properties as keywords or provide a dictionary of JS code snippets which maps from the source parameter to a JS code snippet which is executed when the property changes.

Parameters:
  • target (panel.viewable.Viewable | bokeh.model.Model | holoviews.core.dimension.Dimensioned) – The target to link the value to.

  • code (dict) – Custom code which will be executed when the widget value changes.

  • args (dict) – A mapping of objects to make available to the JS callback

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – A mapping between properties on the source model and the target model property to link it to.

Returns:

link – The GenericLink which can be used unlink the widget and the target model.

Return type:

GenericLink

Links the parameters on this Reactive object to attributes on the target Parameterized object.

Supports two modes, either specify a mapping between the source and target object parameters as keywords or provide a dictionary of callbacks which maps from the source parameter to a callback which is triggered when the parameter changes.

Parameters:
  • target (param.Parameterized) – The target object of the link.

  • callbacks (dict | None) – Maps from a parameter in the source object to a callback.

  • bidirectional (bool) – Whether to link source and target bi-directionally

  • **links (dict) – Maps between parameters on this object to the parameters on the supplied object.

save(filename: str | os.PathLike | IO, title: Optional[str] = None, resources: bokeh.resources.Resources | None = None, template: str | jinja2.environment.Template | None = None, template_variables: Dict[str, Any] = {}, embed: bool = False, max_states: int = 1000, max_opts: int = 3, embed_json: bool = False, json_prefix: str = '', save_path: str = './', load_path: Optional[str] = None, progress: bool = True, embed_states: Dict[Any, Any] = {}, as_png: bool | None = None, **kwargs) β†’ None[source]#

Saves Panel objects to file.

Parameters:
  • filename (str or file-like object) – Filename to save the plot to

  • title (string) – Optional title for the plot

  • resources (bokeh resources) – One of the valid bokeh.resources (e.g. CDN or INLINE)

  • template – passed to underlying io.save

  • template_variables – passed to underlying io.save

  • embed (bool) – Whether the state space should be embedded in the saved file.

  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • embed_json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for the auto-generated json directory

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=True)) – Whether to report progress

  • embed_states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

  • as_png (boolean (default=None)) – To save as a .png. If None save_png will be true if filename is string and ends with png.

select(selector: Optional[Union[type, Callable[[Viewable], bool]]] = None) β†’ List[Viewable][source]#

Iterates over the Viewable and any potential children in the applying the Selector.

Parameters:

selector (type or callable or None) – The selector allows selecting a subset of Viewables by declaring a type or callable function to filter by.

Returns:

viewables

Return type:

list(Viewable)

servable(title: Optional[str] = None, location: bool | 'Location' = True, area: str = 'main', target: Optional[str] = None) β†’ ServableMixin[source]#

Serves the object or adds it to the configured pn.state.template if in a panel serve context, writes to the DOM if in a pyodide context and returns the Panel object to allow it to display itself in a notebook context.

Parameters:
  • title (str) – A string title to give the Document (if served as an app)

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

  • area (str (deprecated)) – The area of a template to add the component too. Only has an effect if pn.config.template has been set.

  • target (str) – Target area to write to. If a template has been configured on pn.config.template this refers to the target area in the template while in pyodide this refers to the ID of the DOM node to write to.

Return type:

The Panel object itself

server_doc(doc: Optional[Document] = None, title: Optional[str] = None, location: bool | 'Location' = True) β†’ Document[source]#

Returns a serveable bokeh Document with the panel attached

Parameters:
  • doc (bokeh.Document (optional)) – The bokeh Document to attach the panel to as a root, defaults to bokeh.io.curdoc()

  • title (str) – A string title to give the Document

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns:

doc – The bokeh document the panel was attached to

Return type:

bokeh.Document

show(title: Optional[str] = None, port: int = 0, address: Optional[str] = None, websocket_origin: Optional[str] = None, threaded: bool = False, verbose: bool = True, open: bool = True, location: bool | 'Location' = True, **kwargs) β†’ StoppableThread' | 'Server[source]#

Starts a Bokeh server and displays the Viewable in a new tab.

Parameters:
  • title (str | None) – A string title to give the Document (if served as an app)

  • port (int (optional, default=0)) – Allows specifying a specific port

  • address (str) – The address the server should listen on for HTTP requests.

  • websocket_origin (str or list(str) (optional)) – A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, β€œlocalhost” is used.

  • threaded (boolean (optional, default=False)) – Whether to launch the Server on a separate thread, allowing interactive use.

  • verbose (boolean (optional, default=True)) – Whether to print the address and port

  • open (boolean (optional, default=True)) – Whether to open the server in a new browser tab

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns:

server – Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)

Return type:

bokeh.server.Server or panel.io.server.StoppableThread

class panel.pane.vtk.vtk.VTKRenderWindowSynchronized(object=None, **params)[source]#

Bases: BaseVTKRenderWindow, SyncHelpers

VTK panes allow rendering VTK objects. Synchronize a vtkRenderWindow constructs on python side with a custom bokeh model on javascript side

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

panel.pane.vtk.vtk.AbstractVTK: axes, camera, color_mappers, orientation_widget

panel.pane.vtk.vtk.BaseVTKRenderWindow: enable_keybindings, serialize_on_instantiation, serialize_all_data_arrays

interactive_orientation_widget = param.Boolean(allow_refs=False, constant=True, default=False, label=’Interactive orientation widget’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15ef2c050>)

_one_time_reset = param.Boolean(allow_refs=False, default=False, label=’ one time reset’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15ef2b210>)

add_actors(actors)[source]#

Add a list of actors to the VTK renderer if reset_camera is True, the current camera and it’s clipping will be reset.

classmethod applies(obj, **kwargs)[source]#

Returns boolean or float indicating whether the Pane can render the object.

If the priority of the pane is set to None, this method may also be used to define a float priority depending on the object being rendered.

clone(object: Optional[Any] = None, **params) β†’ T[source]#

Makes a copy of the Pane sharing the same parameters.

Parameters:
  • object (Optional new object to render) –

  • params (Keyword arguments override the parameters on the clone.) –

Return type:

Cloned Pane object

controls(parameters: List[str] = [], jslink: bool = True, **kwargs) β†’ Panel[source]#

Creates a set of widgets which allow manipulating the parameters on this instance. By default all parameters which support linking are exposed, but an explicit list of parameters can be provided.

Parameters:
  • parameters (list(str)) – An explicit list of parameters to return controls for.

  • jslink (bool) – Whether to use jslinks instead of Python based links. This does not allow using all types of parameters.

  • kwargs (dict) – Additional kwargs to pass to the Param pane(s) used to generate the controls widgets.

Return type:

A layout of the controls

default_layout[source]#

alias of Row

embed(max_states: int = 1000, max_opts: int = 3, json: bool = False, json_prefix: str = '', save_path: str = './', load_path: Optional[str] = None, progress: bool = False, states={}) β†’ None[source]#

Renders a static version of a panel in a notebook by evaluating the set of states defined by the widgets in the model. Note this will only work well for simple apps with a relatively small state space.

Parameters:
  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for JSON filename

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=False)) – Whether to report progress

  • states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

classmethod get_pane_type(obj: Any, **kwargs) β†’ Type[PaneBase][source]#

Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.

Parameters:

(object) (obj) –

Return type:

The applicable Pane type with the highest precedence.

get_renderer()[source]#

Get the vtk Renderer associated to this pane

get_root(doc: Optional[Document] = None, comm: Comm | None = None, preprocess: bool = True) β†’ Model[source]#

Returns the root model and applies pre-processing hooks

Parameters:
  • doc (bokeh.document.Document) – Optional Bokeh document the bokeh model will be attached to.

  • comm (pyviz_comms.Comm) – Optional pyviz_comms when working in notebook

  • preprocess (bool (default=True)) – Whether to run preprocessing hooks

Return type:

Returns the bokeh model corresponding to this panel object

jscallback(args: Dict[str, Any] = {}, **callbacks: str) β†’ Callback[source]#

Allows defining a JS callback to be triggered when a property changes on the source object. The keyword arguments define the properties that trigger a callback and the JS code that gets executed.

Parameters:
  • args (dict) – A mapping of objects to make available to the JS callback

  • **callbacks (dict) – A mapping between properties on the source model and the code to execute when that property changes

Returns:

callback – The Callback which can be used to disable the callback.

Return type:

Callback

Links properties on the this Reactive object to those on the target Reactive object in JS code.

Supports two modes, either specify a mapping between the source and target model properties as keywords or provide a dictionary of JS code snippets which maps from the source parameter to a JS code snippet which is executed when the property changes.

Parameters:
  • target (panel.viewable.Viewable | bokeh.model.Model | holoviews.core.dimension.Dimensioned) – The target to link the value to.

  • code (dict) – Custom code which will be executed when the widget value changes.

  • args (dict) – A mapping of objects to make available to the JS callback

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – A mapping between properties on the source model and the target model property to link it to.

Returns:

link – The GenericLink which can be used unlink the widget and the target model.

Return type:

GenericLink

Links the parameters on this Reactive object to attributes on the target Parameterized object.

Supports two modes, either specify a mapping between the source and target object parameters as keywords or provide a dictionary of callbacks which maps from the source parameter to a callback which is triggered when the parameter changes.

Parameters:
  • target (param.Parameterized) – The target object of the link.

  • callbacks (dict | None) – Maps from a parameter in the source object to a callback.

  • bidirectional (bool) – Whether to link source and target bi-directionally

  • **links (dict) – Maps between parameters on this object to the parameters on the supplied object.

Associate the camera of an other VTKSynchronized pane to this renderer

remove_actors(actors)[source]#

Add a list of actors to the VTK renderer if reset_camera is True, the current camera and it’s clipping will be reset.

reset_camera()[source]#

Reset the camera

save(filename: str | os.PathLike | IO, title: Optional[str] = None, resources: bokeh.resources.Resources | None = None, template: str | jinja2.environment.Template | None = None, template_variables: Dict[str, Any] = {}, embed: bool = False, max_states: int = 1000, max_opts: int = 3, embed_json: bool = False, json_prefix: str = '', save_path: str = './', load_path: Optional[str] = None, progress: bool = True, embed_states: Dict[Any, Any] = {}, as_png: bool | None = None, **kwargs) β†’ None[source]#

Saves Panel objects to file.

Parameters:
  • filename (str or file-like object) – Filename to save the plot to

  • title (string) – Optional title for the plot

  • resources (bokeh resources) – One of the valid bokeh.resources (e.g. CDN or INLINE)

  • template – passed to underlying io.save

  • template_variables – passed to underlying io.save

  • embed (bool) – Whether the state space should be embedded in the saved file.

  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • embed_json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for the auto-generated json directory

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=True)) – Whether to report progress

  • embed_states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

  • as_png (boolean (default=None)) – To save as a .png. If None save_png will be true if filename is string and ends with png.

select(selector: Optional[Union[type, Callable[[Viewable], bool]]] = None) β†’ List[Viewable][source]#

Iterates over the Viewable and any potential children in the applying the Selector.

Parameters:

selector (type or callable or None) – The selector allows selecting a subset of Viewables by declaring a type or callable function to filter by.

Returns:

viewables

Return type:

list(Viewable)

servable(title: Optional[str] = None, location: bool | 'Location' = True, area: str = 'main', target: Optional[str] = None) β†’ ServableMixin[source]#

Serves the object or adds it to the configured pn.state.template if in a panel serve context, writes to the DOM if in a pyodide context and returns the Panel object to allow it to display itself in a notebook context.

Parameters:
  • title (str) – A string title to give the Document (if served as an app)

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

  • area (str (deprecated)) – The area of a template to add the component too. Only has an effect if pn.config.template has been set.

  • target (str) – Target area to write to. If a template has been configured on pn.config.template this refers to the target area in the template while in pyodide this refers to the ID of the DOM node to write to.

Return type:

The Panel object itself

server_doc(doc: Optional[Document] = None, title: Optional[str] = None, location: bool | 'Location' = True) β†’ Document[source]#

Returns a serveable bokeh Document with the panel attached

Parameters:
  • doc (bokeh.Document (optional)) – The bokeh Document to attach the panel to as a root, defaults to bokeh.io.curdoc()

  • title (str) – A string title to give the Document

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns:

doc – The bokeh document the panel was attached to

Return type:

bokeh.Document

show(title: Optional[str] = None, port: int = 0, address: Optional[str] = None, websocket_origin: Optional[str] = None, threaded: bool = False, verbose: bool = True, open: bool = True, location: bool | 'Location' = True, **kwargs) β†’ StoppableThread' | 'Server[source]#

Starts a Bokeh server and displays the Viewable in a new tab.

Parameters:
  • title (str | None) – A string title to give the Document (if served as an app)

  • port (int (optional, default=0)) – Allows specifying a specific port

  • address (str) – The address the server should listen on for HTTP requests.

  • websocket_origin (str or list(str) (optional)) – A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, β€œlocalhost” is used.

  • threaded (boolean (optional, default=False)) – Whether to launch the Server on a separate thread, allowing interactive use.

  • verbose (boolean (optional, default=True)) – Whether to print the address and port

  • open (boolean (optional, default=True)) – Whether to open the server in a new browser tab

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns:

server – Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)

Return type:

bokeh.server.Server or panel.io.server.StoppableThread

synchronize()[source]#

function to synchronize the renderer with the view

Create a fresh vtkCamera instance and set it to the renderer

class panel.pane.vtk.vtk.VTKVolume(object=None, **params)[source]#

Bases: AbstractVTK

The VTKVolume pane renders 3d volumetric data defined on regular grids. It may be constructed from a 3D NumPy array or a vtkVolume.

The pane provides a number of interactive control which can be set either through callbacks from Python or Javascript callbacks.

Reference: https://panel.holoviz.org/reference/panes/VTKVolume.html

Example:

>>> pn.extension('vtk')
>>> VTKVolume(
...    data_matrix, spacing=(3,2,1), interpolation='nearest',
...    edge_gradient=0, sampling=0,
...    sizing_mode='stretch_width', height=400,
... )

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

panel.pane.vtk.vtk.AbstractVTK: axes, camera, color_mappers, orientation_widget, interactive_orientation_widget

ambient = param.Number(allow_refs=False, default=0.2, inclusive_bounds=(True, True), label=’Ambient’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x166c62910>, step=0.01)

Value to control the ambient lighting. It is the light an object gives even in the absence of strong light. It is constant in all directions.

controller_expanded = param.Boolean(allow_refs=False, default=True, label=’Controller expanded’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15f46d6d0>)

If True the volume controller panel options is expanded in the view

colormap = param.Selector(allow_refs=False, default=’erdc_rainbow_bright’, label=’Colormap’, names={}, nested_refs=False, objects=[β€˜KAAMS’, β€˜Cool to Warm’, β€˜Cool to Warm (Extended)’, β€˜Warm to Cool’, β€˜Warm to Cool (Extended)’, β€˜Rainbow Desaturated’, β€˜Cold and Hot’, β€˜Black-Body Radiation’, β€˜X Ray’, β€˜Grayscale’, β€˜BkRd’, β€˜BkGn’, β€˜BkBu’, β€˜BkMa’, β€˜BkCy’, β€˜Black, Blue and White’, β€˜Black, Orange and White’, β€˜Linear YGB 1211g’, β€˜Linear Green (Gr4L)’, β€˜Linear Blue (8_31f)’, β€˜Blue to Red Rainbow’, β€˜Red to Blue Rainbow’, β€˜Rainbow Blended White’, β€˜Rainbow Blended Grey’, β€˜Rainbow Blended Black’, β€˜Blue to Yellow’, β€˜blot’, β€˜CIELab Blue to Red’, β€˜jet’, β€˜rainbow’, β€˜erdc_rainbow_bright’, β€˜erdc_rainbow_dark’, β€˜nic_CubicL’, β€˜nic_CubicYF’, β€˜gist_earth’, β€˜2hot’, β€˜erdc_red2yellow_BW’, β€˜erdc_marine2gold_BW’, β€˜erdc_blue2gold_BW’, β€˜erdc_sapphire2gold_BW’, β€˜erdc_red2purple_BW’, β€˜erdc_purple2pink_BW’, β€˜erdc_pbj_lin’, β€˜erdc_blue2green_muted’, β€˜erdc_blue2green_BW’, β€˜GREEN-WHITE_LINEAR’, β€˜erdc_green2yellow_BW’, β€˜blue2cyan’, β€˜erdc_blue2cyan_BW’, β€˜erdc_blue_BW’, β€˜BLUE-WHITE’, β€˜erdc_purple_BW’, β€˜erdc_magenta_BW’, β€˜magenta’, β€˜RED-PURPLE’, β€˜erdc_red_BW’, β€˜RED_TEMPERATURE’, β€˜erdc_orange_BW’, β€˜heated_object’, β€˜erdc_gold_BW’, β€˜erdc_brown_BW’, β€˜copper_Matlab’, β€˜pink_Matlab’, β€˜bone_Matlab’, β€˜gray_Matlab’, β€˜Purples’, β€˜Blues’, β€˜Greens’, β€˜PuBu’, β€˜BuPu’, β€˜BuGn’, β€˜GnBu’, β€˜GnBuPu’, β€˜BuGnYl’, β€˜PuRd’, β€˜RdPu’, β€˜Oranges’, β€˜Reds’, β€˜RdOr’, β€˜BrOrYl’, β€˜RdOrYl’, β€˜CIELab_blue2red’, β€˜blue2yellow’, β€˜erdc_blue2gold’, β€˜erdc_blue2yellow’, β€˜erdc_cyan2orange’, β€˜erdc_purple2green’, β€˜erdc_purple2green_dark’, β€˜coolwarm’, β€˜BuRd’, β€˜Spectral_lowBlue’, β€˜GnRP’, β€˜GYPi’, β€˜GnYlRd’, β€˜GBBr’, β€˜PuOr’, β€˜PRGn’, β€˜PiYG’, β€˜OrPu’, β€˜BrBG’, β€˜GyRd’, β€˜erdc_divHi_purpleGreen’, β€˜erdc_divHi_purpleGreen_dim’, β€˜erdc_divLow_icePeach’, β€˜erdc_divLow_purpleGreen’, β€˜Haze_green’, β€˜Haze_lime’, β€˜Haze’, β€˜Haze_cyan’, β€˜nic_Edge’, β€˜erdc_iceFire_H’, β€˜erdc_iceFire_L’, β€˜hsv’, β€˜hue_L60’, β€˜Spectrum’, β€˜Warm’, β€˜Cool’, β€˜Blues’, β€˜Wild Flower’, β€˜Citrus’, β€˜Brewer Diverging Purple-Orange (11)’, β€˜Brewer Diverging Purple-Orange (10)’, β€˜Brewer Diverging Purple-Orange (9)’, β€˜Brewer Diverging Purple-Orange (8)’, β€˜Brewer Diverging Purple-Orange (7)’, β€˜Brewer Diverging Purple-Orange (6)’, β€˜Brewer Diverging Purple-Orange (5)’, β€˜Brewer Diverging Purple-Orange (4)’, β€˜Brewer Diverging Purple-Orange (3)’, β€˜Brewer Diverging Spectral (11)’, β€˜Brewer Diverging Spectral (10)’, β€˜Brewer Diverging Spectral (9)’, β€˜Brewer Diverging Spectral (8)’, β€˜Brewer Diverging Spectral (7)’, β€˜Brewer Diverging Spectral (6)’, β€˜Brewer Diverging Spectral (5)’, β€˜Brewer Diverging Spectral (4)’, β€˜Brewer Diverging Spectral (3)’, β€˜Brewer Diverging Brown-Blue-Green (11)’, β€˜Brewer Diverging Brown-Blue-Green (10)’, β€˜Brewer Diverging Brown-Blue-Green (9)’, β€˜Brewer Diverging Brown-Blue-Green (8)’, β€˜Brewer Diverging Brown-Blue-Green (7)’, β€˜Brewer Diverging Brown-Blue-Green (6)’, β€˜Brewer Diverging Brown-Blue-Green (5)’, β€˜Brewer Diverging Brown-Blue-Green (4)’, β€˜Brewer Diverging Brown-Blue-Green (3)’, β€˜Brewer Sequential Blue-Green (9)’, β€˜Brewer Sequential Blue-Green (8)’, β€˜Brewer Sequential Blue-Green (7)’, β€˜Brewer Sequential Blue-Green (6)’, β€˜Brewer Sequential Blue-Green (5)’, β€˜Brewer Sequential Blue-Green (4)’, β€˜Brewer Sequential Blue-Green (3)’, β€˜Brewer Sequential Yellow-Orange-Brown (9)’, β€˜Brewer Sequential Yellow-Orange-Brown (8)’, β€˜Brewer Sequential Yellow-Orange-Brown (7)’, β€˜Brewer Sequential Yellow-Orange-Brown (6)’, β€˜Brewer Sequential Yellow-Orange-Brown (5)’, β€˜Brewer Sequential Yellow-Orange-Brown (4)’, β€˜Brewer Sequential Yellow-Orange-Brown (3)’, β€˜Brewer Sequential Blue-Purple (9)’, β€˜Brewer Sequential Blue-Purple (8)’, β€˜Brewer Sequential Blue-Purple (7)’, β€˜Brewer Sequential Blue-Purple (6)’, β€˜Brewer Sequential Blue-Purple (5)’, β€˜Brewer Sequential Blue-Purple (4)’, β€˜Brewer Sequential Blue-Purple (3)’, β€˜Brewer Qualitative Accent’, β€˜Brewer Qualitative Dark2’, β€˜Brewer Qualitative Set2’, β€˜Brewer Qualitative Pastel2’, β€˜Brewer Qualitative Pastel1’, β€˜Brewer Qualitative Set1’, β€˜Brewer Qualitative Paired’, β€˜Brewer Qualitative Set3’, β€˜Traffic Lights’, β€˜Traffic Lights For Deuteranopes’, β€˜Traffic Lights For Deuteranopes 2’, β€˜Muted Blue-Green’, β€˜Green-Blue Asymmetric Divergent (62Blbc)’, β€˜Asymmtrical Earth Tones (6_21b)’, β€˜Yellow 15’, β€˜Magma (matplotlib)’, β€˜Inferno (matplotlib)’, β€˜Plasma (matplotlib)’, β€˜Viridis (matplotlib)’, β€˜BlueObeliskElements’], rx=<param.reactive.reactive_ops object at 0x15ef2f350>)

Name of the colormap used to transform pixel value in color.

diffuse = param.Number(allow_refs=False, default=0.7, inclusive_bounds=(True, True), label=’Diffuse’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15f46ee50>, step=0.01)

Value to control the diffuse Lighting. It relies on both the light direction and the object surface normal.

display_volume = param.Boolean(allow_refs=False, default=True, label=’Display volume’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15ef2d810>)

If set to True, the 3D representation of the volume is displayed using ray casting.

display_slices = param.Boolean(allow_refs=False, default=False, label=’Display slices’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15f46fc90>)

If set to true, the orthgonal slices in the three (X, Y, Z) directions are displayed. Position of each slice can be controlled using slice_(i,j,k) parameters.

edge_gradient = param.Number(allow_refs=False, bounds=(0, 1), default=0.4, inclusive_bounds=(True, True), label=’Edge gradient’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15ef2f550>, step=0.01)

Parameter to adjust the opacity of the volume based on the gradient between voxels.

interpolation = param.Selector(allow_refs=False, default=’fast_linear’, label=’Interpolation’, names={}, nested_refs=False, objects=[β€˜fast_linear’, β€˜linear’, β€˜nearest’], rx=<param.reactive.reactive_ops object at 0x15f46fb90>)

interpolation type for sampling a volume. nearest interpolation will snap to the closest voxel, linear will perform trilinear interpolation to compute a scalar value from surrounding voxels. fast_linear under WebGL 1 will perform bilinear interpolation on X and Y but use nearest for Z. This is slightly faster than full linear at the cost of no Z axis linear interpolation.

mapper = param.Dict(allow_None=True, allow_refs=False, class_=<class β€˜dict’>, label=’Mapper’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15ef2d490>)

Lookup Table in format {low, high, palette}

max_data_size = param.Number(allow_refs=False, default=33.554432, inclusive_bounds=(True, True), label=’Max data size’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15ef2f350>)

Maximum data size transfer allowed without subsampling

nan_opacity = param.Number(allow_refs=False, bounds=(0.0, 1.0), default=1.0, inclusive_bounds=(True, True), label=’Nan opacity’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15ebbcb90>)

Opacity applied to nan values in slices

origin = param.Tuple(allow_None=True, allow_refs=False, label=’Origin’, length=3, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x165a42650>)

render_background = param.Color(allow_named=True, allow_refs=False, default=’#52576e’, label=’Render background’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x166d3f8d0>)

Allows to specify the background color of the 3D rendering. The value must be specified as an hexadecimal color string.

rescale = param.Boolean(allow_refs=False, default=False, label=’Rescale’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x165a42650>)

If set to True the colormap is rescaled between min and max value of the non-transparent pixel, otherwise the full range of the pixel values are used.

shadow = param.Boolean(allow_refs=False, default=True, label=’Shadow’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15f46dd10>)

If set to False, then the mapper for the volume will not perform shading computations, it is the same as setting ambient=1, diffuse=0, specular=0.

sampling = param.Number(allow_refs=False, bounds=(0, 1), default=0.4, inclusive_bounds=(True, True), label=’Sampling’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15f46f890>, step=0.01)

Parameter to adjust the distance between samples used for rendering. The lower the value is the more precise is the representation but it is more computationally intensive.

spacing = param.Tuple(allow_refs=False, default=(1, 1, 1), label=’Spacing’, length=3, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15f46dd10>)

Distance between voxel in each direction

specular = param.Number(allow_refs=False, default=0.3, inclusive_bounds=(True, True), label=’Specular’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15f46f890>, step=0.01)

Value to control specular lighting. It is the light reflects back toward the camera when hitting the object.

specular_power = param.Number(allow_refs=False, default=8.0, inclusive_bounds=(True, True), label=’Specular power’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15ef2e350>)

Specular power refers to how much light is reflected in a mirror like fashion, rather than scattered randomly in a diffuse manner.

slice_i = param.Integer(allow_refs=False, default=0, inclusive_bounds=(True, True), label=’Slice i’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x166f820d0>)

Integer parameter to control the position of the slice normal to the X direction.

slice_j = param.Integer(allow_refs=False, default=0, inclusive_bounds=(True, True), label=’Slice j’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15ef2e010>)

Integer parameter to control the position of the slice normal to the Y direction.

slice_k = param.Integer(allow_refs=False, default=0, inclusive_bounds=(True, True), label=’Slice k’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x15f46ee50>)

Integer parameter to control the position of the slice normal to the Z direction.

classmethod applies(obj: Any) β†’ float | bool | None[source]#

Returns boolean or float indicating whether the Pane can render the object.

If the priority of the pane is set to None, this method may also be used to define a float priority depending on the object being rendered.

clone(object: Optional[Any] = None, **params) β†’ T[source]#

Makes a copy of the Pane sharing the same parameters.

Parameters:
  • object (Optional new object to render) –

  • params (Keyword arguments override the parameters on the clone.) –

Return type:

Cloned Pane object

controls(parameters: List[str] = [], jslink: bool = True, **kwargs) β†’ Panel[source]#

Creates a set of widgets which allow manipulating the parameters on this instance. By default all parameters which support linking are exposed, but an explicit list of parameters can be provided.

Parameters:
  • parameters (list(str)) – An explicit list of parameters to return controls for.

  • jslink (bool) – Whether to use jslinks instead of Python based links. This does not allow using all types of parameters.

  • kwargs (dict) – Additional kwargs to pass to the Param pane(s) used to generate the controls widgets.

Return type:

A layout of the controls

default_layout[source]#

alias of Row

embed(max_states: int = 1000, max_opts: int = 3, json: bool = False, json_prefix: str = '', save_path: str = './', load_path: Optional[str] = None, progress: bool = False, states={}) β†’ None[source]#

Renders a static version of a panel in a notebook by evaluating the set of states defined by the widgets in the model. Note this will only work well for simple apps with a relatively small state space.

Parameters:
  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for JSON filename

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=False)) – Whether to report progress

  • states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

classmethod get_pane_type(obj: Any, **kwargs) β†’ Type[PaneBase][source]#

Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.

Parameters:

(object) (obj) –

Return type:

The applicable Pane type with the highest precedence.

get_root(doc: Optional[Document] = None, comm: Comm | None = None, preprocess: bool = True) β†’ Model[source]#

Returns the root model and applies pre-processing hooks

Parameters:
  • doc (bokeh.document.Document) – Optional Bokeh document the bokeh model will be attached to.

  • comm (pyviz_comms.Comm) – Optional pyviz_comms when working in notebook

  • preprocess (bool (default=True)) – Whether to run preprocessing hooks

Return type:

Returns the bokeh model corresponding to this panel object

jscallback(args: Dict[str, Any] = {}, **callbacks: str) β†’ Callback[source]#

Allows defining a JS callback to be triggered when a property changes on the source object. The keyword arguments define the properties that trigger a callback and the JS code that gets executed.

Parameters:
  • args (dict) – A mapping of objects to make available to the JS callback

  • **callbacks (dict) – A mapping between properties on the source model and the code to execute when that property changes

Returns:

callback – The Callback which can be used to disable the callback.

Return type:

Callback

Links properties on the this Reactive object to those on the target Reactive object in JS code.

Supports two modes, either specify a mapping between the source and target model properties as keywords or provide a dictionary of JS code snippets which maps from the source parameter to a JS code snippet which is executed when the property changes.

Parameters:
  • target (panel.viewable.Viewable | bokeh.model.Model | holoviews.core.dimension.Dimensioned) – The target to link the value to.

  • code (dict) – Custom code which will be executed when the widget value changes.

  • args (dict) – A mapping of objects to make available to the JS callback

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – A mapping between properties on the source model and the target model property to link it to.

Returns:

link – The GenericLink which can be used unlink the widget and the target model.

Return type:

GenericLink

Links the parameters on this Reactive object to attributes on the target Parameterized object.

Supports two modes, either specify a mapping between the source and target object parameters as keywords or provide a dictionary of callbacks which maps from the source parameter to a callback which is triggered when the parameter changes.

Parameters:
  • target (param.Parameterized) – The target object of the link.

  • callbacks (dict | None) – Maps from a parameter in the source object to a callback.

  • bidirectional (bool) – Whether to link source and target bi-directionally

  • **links (dict) – Maps between parameters on this object to the parameters on the supplied object.

classmethod register_serializer(class_type, serializer)[source]#

Register a serializer for a given type of class. A serializer is a function which take an instance of class_type (like a vtk.vtkImageData) as input and return a numpy array of the data

save(filename: str | os.PathLike | IO, title: Optional[str] = None, resources: bokeh.resources.Resources | None = None, template: str | jinja2.environment.Template | None = None, template_variables: Dict[str, Any] = {}, embed: bool = False, max_states: int = 1000, max_opts: int = 3, embed_json: bool = False, json_prefix: str = '', save_path: str = './', load_path: Optional[str] = None, progress: bool = True, embed_states: Dict[Any, Any] = {}, as_png: bool | None = None, **kwargs) β†’ None[source]#

Saves Panel objects to file.

Parameters:
  • filename (str or file-like object) – Filename to save the plot to

  • title (string) – Optional title for the plot

  • resources (bokeh resources) – One of the valid bokeh.resources (e.g. CDN or INLINE)

  • template – passed to underlying io.save

  • template_variables – passed to underlying io.save

  • embed (bool) – Whether the state space should be embedded in the saved file.

  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • embed_json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for the auto-generated json directory

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=True)) – Whether to report progress

  • embed_states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

  • as_png (boolean (default=None)) – To save as a .png. If None save_png will be true if filename is string and ends with png.

select(selector: Optional[Union[type, Callable[[Viewable], bool]]] = None) β†’ List[Viewable][source]#

Iterates over the Viewable and any potential children in the applying the Selector.

Parameters:

selector (type or callable or None) – The selector allows selecting a subset of Viewables by declaring a type or callable function to filter by.

Returns:

viewables

Return type:

list(Viewable)

servable(title: Optional[str] = None, location: bool | 'Location' = True, area: str = 'main', target: Optional[str] = None) β†’ ServableMixin[source]#

Serves the object or adds it to the configured pn.state.template if in a panel serve context, writes to the DOM if in a pyodide context and returns the Panel object to allow it to display itself in a notebook context.

Parameters:
  • title (str) – A string title to give the Document (if served as an app)

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

  • area (str (deprecated)) – The area of a template to add the component too. Only has an effect if pn.config.template has been set.

  • target (str) – Target area to write to. If a template has been configured on pn.config.template this refers to the target area in the template while in pyodide this refers to the ID of the DOM node to write to.

Return type:

The Panel object itself

server_doc(doc: Optional[Document] = None, title: Optional[str] = None, location: bool | 'Location' = True) β†’ Document[source]#

Returns a serveable bokeh Document with the panel attached

Parameters:
  • doc (bokeh.Document (optional)) – The bokeh Document to attach the panel to as a root, defaults to bokeh.io.curdoc()

  • title (str) – A string title to give the Document

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns:

doc – The bokeh document the panel was attached to

Return type:

bokeh.Document

show(title: Optional[str] = None, port: int = 0, address: Optional[str] = None, websocket_origin: Optional[str] = None, threaded: bool = False, verbose: bool = True, open: bool = True, location: bool | 'Location' = True, **kwargs) β†’ StoppableThread' | 'Server[source]#

Starts a Bokeh server and displays the Viewable in a new tab.

Parameters:
  • title (str | None) – A string title to give the Document (if served as an app)

  • port (int (optional, default=0)) – Allows specifying a specific port

  • address (str) – The address the server should listen on for HTTP requests.

  • websocket_origin (str or list(str) (optional)) – A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, β€œlocalhost” is used.

  • threaded (boolean (optional, default=False)) – Whether to launch the Server on a separate thread, allowing interactive use.

  • verbose (boolean (optional, default=True)) – Whether to print the address and port

  • open (boolean (optional, default=True)) – Whether to open the server in a new browser tab

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns:

server – Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)

Return type:

bokeh.server.Server or panel.io.server.StoppableThread