panel.vtk Package#
vtk
Package#
enums
Module#
synchronizable_deserializer
Module#
synchronizable_serializer
Module#
vtk
Module#
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, visiblepanel.viewable.Viewable
: loadingpanel.pane.base.PaneBase
: margin, default_layout, objectaxes
= 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
andzticker
. Aticker
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
- 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:
- jslink(target: JSLinkTarget, code: Dict[str, str] = None, args: Optional[Dict] = None, bidirectional: bool = False, **links: str) Link [source]#
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
- link(target: Parameterized, callbacks: Optional[Dict[str, Union[str, Callable]]] = None, bidirectional: bool = False, **links: str) Watcher [source]#
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, visiblepanel.viewable.Viewable
: loadingpanel.pane.base.PaneBase
: margin, default_layout, objectpanel.pane.vtk.vtk.AbstractVTK
: axes, camera, color_mappers, orientation_widget, interactive_orientation_widgetenable_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
- 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:
- jslink(target: JSLinkTarget, code: Dict[str, str] = None, args: Optional[Dict] = None, bidirectional: bool = False, **links: str) Link [source]#
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
- link(target: Parameterized, callbacks: Optional[Dict[str, Union[str, Callable]]] = None, bidirectional: bool = False, **links: str) Watcher [source]#
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.
- 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, visiblepanel.viewable.Viewable
: loadingpanel.pane.base.PaneBase
: margin, default_layout, objectpanel.pane.vtk.vtk.AbstractVTK
: axes, camera, color_mappers, orientation_widget, interactive_orientation_widgetenable_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
- 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:
- jslink(target: JSLinkTarget, code: Dict[str, str] = None, args: Optional[Dict] = None, bidirectional: bool = False, **links: str) Link [source]#
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
- link(target: Parameterized, callbacks: Optional[Dict[str, Union[str, Callable]]] = None, bidirectional: bool = False, **links: str) Watcher [source]#
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, visiblepanel.viewable.Viewable
: loadingpanel.pane.base.PaneBase
: margin, default_layout, objectpanel.pane.vtk.vtk.AbstractVTK
: axes, camera, color_mappers, orientation_widget, interactive_orientation_widgetpanel.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
- 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:
- jslink(target: JSLinkTarget, code: Dict[str, str] = None, args: Optional[Dict] = None, bidirectional: bool = False, **links: str) Link [source]#
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
- link(target: Parameterized, callbacks: Optional[Dict[str, Union[str, Callable]]] = None, bidirectional: bool = False, **links: str) Watcher [source]#
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, visiblepanel.viewable.Viewable
: loadingpanel.pane.base.PaneBase
: margin, default_layout, objectpanel.pane.vtk.vtk.AbstractVTK
: axes, camera, color_mappers, orientation_widgetpanel.pane.vtk.vtk.BaseVTKRenderWindow
: enable_keybindings, serialize_on_instantiation, serialize_all_data_arraysinteractive_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
- 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:
- jslink(target: JSLinkTarget, code: Dict[str, str] = None, args: Optional[Dict] = None, bidirectional: bool = False, **links: str) Link [source]#
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
- link(target: Parameterized, callbacks: Optional[Dict[str, Union[str, Callable]]] = None, bidirectional: bool = False, **links: str) Watcher [source]#
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.
- 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.
- 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.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, visiblepanel.viewable.Viewable
: loadingpanel.pane.base.PaneBase
: margin, default_layout, objectpanel.pane.vtk.vtk.AbstractVTK
: axes, camera, color_mappers, orientation_widget, interactive_orientation_widgetambient
= 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
- 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:
- jslink(target: JSLinkTarget, code: Dict[str, str] = None, args: Optional[Dict] = None, bidirectional: bool = False, **links: str) Link [source]#
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
- link(target: Parameterized, callbacks: Optional[Dict[str, Union[str, Callable]]] = None, bidirectional: bool = False, **links: str) Watcher [source]#
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