panel.pane Package


pane Package

The pane module contains PaneBase objects which may render any type of object as a bokeh model so it can be embedded in a panel. The pane objects are one of three main components in panel the other two being layouts and widgets. Panes may render anything including plots, text, images, equations etc.


ace Module

Inheritance diagram of panel.pane.ace
class panel.pane.ace.Ace(object=None, **params)[source]

Bases: panel.pane.base.PaneBase

Ace panes allow rendering Ace editor.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout

object = param.String(default=’’)

The code to be displayed.

annotations = param.List(bounds=(0, None), default=[])

List of annotations to add to the editor.

language = param.String(default=’python’)

Language of the editor.

theme = param.String(default=’chrome’)

Theme of the editor.

readonly = param.Boolean(bounds=(0, 1), default=False)

Define if editor content can be modified.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread


base Module

Inheritance diagram of panel.pane.base

Defines the PaneBase class defining the API for panes which convert objects to a visual representation expressed as a bokeh model.

panel.pane.base.Pane(obj, **kwargs)[source]

Converts any object to a Pane if a matching Pane class exists.

class panel.pane.base.PaneBase(object=None, **params)[source]

Bases: panel.viewable.Reactive

PaneBase is the abstract baseclass for all atomic displayable units in the panel library. Pane defines an extensible interface for wrapping arbitrary objects and transforming them into Bokeh models.

Panes are reactive in the sense that when the object they are wrapping is changed any dashboard containing the pane will update in response.

To define a concrete Pane type subclass this class and implement the applies classmethod and the _get_model private method.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

default_layout = param.ClassSelector(class_=<class ‘panel.layout.Panel’>, default=<class ‘panel.layout.Row’>)

Defines the layout the model(s) returned by the pane will be placed in.

object = param.Parameter()

The object being wrapped, which will be converted to a Bokeh model.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)[source]

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)[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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)[source]

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

class panel.pane.base.ReplacementPane(object=None, **params)[source]

Bases: panel.pane.base.PaneBase

A Pane type which allows for complete replacement of the underlying bokeh model by creating an internal layout to replace the children on.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)[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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

exception panel.pane.base.RerenderError[source]

Bases: RuntimeError

Error raised when a pane requests re-rendering during initial render.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

panel.pane.base.panel(obj, **kwargs)[source]

Creates a panel from any supplied object by wrapping it in a pane and returning a corresponding Panel.

Parameters
  • obj (object) – Any object to be turned into a Panel

  • **kwargs (dict) – Any keyword arguments to be passed to the applicable Pane

Returns

layout – A Viewable representation of the input object

Return type

Viewable


deckgl Module

Inheritance diagram of panel.pane.deckgl

Defines a PyDeck Pane which renders a PyDeck plot using a PyDeckPlot bokeh model.

class panel.pane.deckgl.DeckGL(object=None, **params)[source]

Bases: panel.pane.base.PaneBase

DeckGL panes allow rendering Deck.Gl/ PyDeck plots in Panel.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

mapbox_api_key = param.String()

The MapBox API key if not supplied by a PyDeck object.

tooltips = param.ClassSelector(class_=(<class ‘bool’>, <class ‘dict’>), default=True)

Whether to enable tooltips

click_state = param.Dict(class_=<class ‘dict’>, default={})

Contains the last click event on the DeckGL plot.

hover_state = param.Dict(class_=<class ‘dict’>, default={})

The current hover state of the DeckGL plot.

view_state = param.Dict(class_=<class ‘dict’>, default={})

The current view state of the DeckGL plot.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

panel.pane.deckgl.lower_camel_case_keys(attrs)[source]

Makes all the keys in a dictionary camel-cased and lower-case

Parameters

attrs (dict) – Dictionary for which all the keys should be converted to camel-case

panel.pane.deckgl.to_camel_case(snake_case)[source]

Makes a snake case string into a camel case one

Parameters

snake_case (str) – Snake-cased string (e.g., “snake_cased”) to be converted to camel-case (e.g., “camelCase”)


equation Module

Inheritance diagram of panel.pane.equation

Renders objects representing equations including LaTeX strings and SymPy objects.

class panel.pane.equation.LaTeX(object=None, **params)[source]

Bases: panel.pane.markup.DivPaneBase

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

panel.pane.markup.DivPaneBase: style

renderer = param.ObjectSelector(objects=[‘katex’, ‘mathjax’])

The JS renderer used to render the LaTeX expression.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

panel.pane.equation.is_sympy_expr(obj)[source]

Test for sympy.Expr types without usually needing to import sympy


holoviews Module

Inheritance diagram of panel.pane.holoviews

HoloViews integration for Panel including a Pane to render HoloViews objects and their widgets and support for Links

class panel.pane.holoviews.HoloViews(object=None, **params)[source]

Bases: panel.pane.base.PaneBase

HoloViews panes render any HoloViews object to a corresponding Bokeh model while respecting the currently selected backend.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

backend = param.ObjectSelector(objects=[‘bokeh’, ‘plotly’, ‘matplotlib’])

The HoloViews backend used to render the plot (if None defaults to the currently selected renderer).

center = param.Boolean(bounds=(0, 1), default=False)

Whether to center the plot.

linked_axes = param.Boolean(bounds=(0, 1), default=True)

Whether to use link the axes of bokeh plots inside this pane across a panel layout.

renderer = param.Parameter()

Explicit renderer instance to use for rendering the HoloViews plot. Overrides the backend.

widget_location = param.ObjectSelector(default=’right_top’, objects=[‘left’, ‘bottom’, ‘right’, ‘top’, ‘top_left’, ‘top_right’, ‘bottom_left’, ‘bottom_right’, ‘left_top’, ‘left_bottom’, ‘right_top’, ‘right_bottom’])

The layout of the plot and the widgets. The value refers to the position of the widgets relative to the plot.

widget_layout = param.ObjectSelector(default=<class ‘panel.layout.WidgetBox’>, objects=[<class ‘panel.layout.WidgetBox’>, <class ‘panel.layout.Row’>, <class ‘panel.layout.Column’>])

The layout object to display the widgets in.

widget_type = param.ObjectSelector(default=’individual’, objects=[‘individual’, ‘scrubber’])

) Whether to generate individual widgets for each dimension or on global scrubber.

widgets = param.Dict(class_=<class ‘dict’>, default={})

A mapping from dimension name to a widget instance which will be used to override the default widgets.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

widget_layout

alias of panel.layout.WidgetBox

Traverses the supplied Viewable searching for Links between any HoloViews based panes.

panel.pane.holoviews.generate_panel_bokeh_map(root_model, panel_views)[source]

mapping panel elements to its bokeh models

panel.pane.holoviews.is_bokeh_element_plot(plot)[source]

Checks whether plotting instance is a HoloViews ElementPlot rendered with the bokeh backend.

Pre-processing hook to allow linking axes across HoloViews bokeh plots.


image Module

Inheritance diagram of panel.pane.image

Contains Image panes including renderers for PNG, SVG, GIF and JPG file types.

class panel.pane.image.GIF(object=None, **params)[source]

Bases: panel.pane.image.ImageBase

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

panel.pane.markup.DivPaneBase: style

panel.pane.image.ImageBase: alt_text, link_url, embed

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

class panel.pane.image.ImageBase(object=None, **params)[source]

Bases: panel.pane.markup.DivPaneBase

Encodes an image as base64 and wraps it in a Bokeh Div model. This is an abstract base class that needs the image type to be specified and specific code for determining the image shape.

The imgtype determines the filetype, extension, and MIME type for this image. Each image type (png,jpg,gif) has a base class that supports anything with a _repr_X_ method (where X is png, gif, etc.), a local file with the given file extension, or a HTTP(S) url with the given extension. Subclasses of each type can provide their own way of obtaining or generating a PNG.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

panel.pane.markup.DivPaneBase: style

alt_text = param.String()

alt text to add to the image tag. The alt text is shown when a user cannot load or display the image.

link_url = param.String()

A link URL to make the image clickable and link to some other website.

embed = param.Boolean(bounds=(0, 1), default=True)

Whether to embed the image as base64.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

class panel.pane.image.JPG(object=None, **params)[source]

Bases: panel.pane.image.ImageBase

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

panel.pane.markup.DivPaneBase: style

panel.pane.image.ImageBase: alt_text, link_url, embed

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

class panel.pane.image.PNG(object=None, **params)[source]

Bases: panel.pane.image.ImageBase

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

panel.pane.markup.DivPaneBase: style

panel.pane.image.ImageBase: alt_text, link_url, embed

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

class panel.pane.image.SVG(object=None, **params)[source]

Bases: panel.pane.image.ImageBase

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

panel.pane.markup.DivPaneBase: style

panel.pane.image.ImageBase: alt_text, link_url, embed

encode = param.Boolean(bounds=(0, 1), default=False)

Whether to enable base64 encoding of the SVG, base64 encoded SVGs do not support links.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread


markup Module

Inheritance diagram of panel.pane.markup

Pane class which render various markup languages including HTML, Markdown, and also regular strings.

class panel.pane.markup.DataFrame(object=None, **params)[source]

Bases: panel.pane.markup.HTML

DataFrame renders pandas, dask and streamz DataFrame types using their custom HTML repr. In the case of a streamz DataFrame the rendered data will update periodically.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

panel.pane.markup.DivPaneBase: style

bold_rows = param.Boolean(bounds=(0, 1), default=True)

Make the row labels bold in the output.

border = param.Integer(default=0, inclusive_bounds=(True, True))

A border=border attribute is included in the opening <table> tag.

classes = param.List(bounds=(0, None), default=[‘panel-df’])

CSS class(es) to apply to the resulting html table.

col_space = param.ClassSelector(class_=(<class ‘str’>, <class ‘int’>))

The minimum width of each column in CSS length units. An int is assumed to be px units.

decimal = param.String(default=’.’)

Character recognized as decimal separator, e.g. ‘,’ in Europe.

float_format = param.Callable()

Formatter function to apply to columns’ elements if they are floats. The result of this function must be a unicode string.

formatters = param.ClassSelector(class_=(<class ‘dict’>, <class ‘list’>))

Formatter functions to apply to columns’ elements by position or name. The result of each function must be a unicode string.

header = param.Boolean(bounds=(0, 1), default=True)

Whether to print column labels.

index = param.Boolean(bounds=(0, 1), default=True)

Whether to print index (row) labels.

index_names = param.Boolean(bounds=(0, 1), default=True)

Prints the names of the indexes.

justify = param.ObjectSelector(objects=[‘left’, ‘right’, ‘center’, ‘justify’, ‘justify-all’, ‘start’, ‘end’, ‘inherit’, ‘match-parent’, ‘initial’, ‘unset’])

How to justify the column labels.

max_rows = param.Integer(inclusive_bounds=(True, True))

Maximum number of rows to display.

max_cols = param.Integer(inclusive_bounds=(True, True))

Maximum number of columns to display.

na_rep = param.String(default=’NaN’)

String representation of NAN to use.

render_links = param.Boolean(bounds=(0, 1), default=False)

Convert URLs to HTML links.

show_dimensions = param.Boolean(bounds=(0, 1), default=False)

Display DataFrame dimensions (number of rows by number of columns).

sparsify = param.Boolean(bounds=(0, 1), default=True)

Set to False for a DataFrame with a hierarchical index to print every multi-index key at each row.

_object = param.Parameter()

Hidden parameter.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

class panel.pane.markup.DivPaneBase(object=None, **params)[source]

Bases: panel.pane.base.PaneBase

Baseclass for Panes which render HTML inside a Bokeh Div. See the documentation for Bokeh Div for more detail about the supported options like style and sizing_mode.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

style = param.Dict(class_=<class ‘dict’>)

Dictionary of CSS property:value pairs to apply to this Div.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

class panel.pane.markup.HTML(object=None, **params)[source]

Bases: panel.pane.markup.DivPaneBase

HTML panes wrap HTML text in a Panel HTML model. The provided object can either be a text string, or an object that has a _repr_html_ method that can be called to get the HTML text string. The height and width can optionally be specified, to allow room for whatever is being wrapped.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

panel.pane.markup.DivPaneBase: style

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

class panel.pane.markup.JSON(object=None, **params)[source]

Bases: panel.pane.markup.DivPaneBase

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

panel.pane.markup.DivPaneBase: style

margin = param.Parameter(default=(5, 20, 5, 5))

Allows to create additional space around the component. May be specified as a two-tuple of the form (vertical, horizontal) or a four-tuple (top, right, bottom, left).

depth = param.Integer(bounds=(-1, None), default=1, inclusive_bounds=(True, True))

Depth to which the JSON tree will be expanded on initialization.

encoder = param.ClassSelector(class_=<class ‘json.encoder.JSONEncoder’>)

Custom JSONEncoder class used to serialize objects to JSON string.

hover_preview = param.Boolean(bounds=(0, 1), default=False)

Whether to display a hover preview for collapsed nodes.

theme = param.ObjectSelector(default=’dark’, objects=[‘light’, ‘dark’])

Whether the JSON tree view is expanded by default.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj, **params)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

class panel.pane.markup.Markdown(object=None, **params)[source]

Bases: panel.pane.markup.DivPaneBase

A Markdown pane renders the markdown markup language to HTML and displays it inside a bokeh Div model. It has no explicit priority since it cannot be easily be distinguished from a standard string, therefore it has to be invoked explicitly.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

panel.pane.markup.DivPaneBase: style

dedent = param.Boolean(bounds=(0, 1), default=True)

Whether to dedent common whitespace across all lines.

extensions = param.List(bounds=(0, None), default=[‘extra’, ‘smarty’, ‘codehilite’])

Markdown extension to apply when transforming markup.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

class panel.pane.markup.Str(object=None, **params)[source]

Bases: panel.pane.markup.DivPaneBase

A Str pane renders any object for which str() can be called, escaping any HTML markup and then wrapping the resulting string in a bokeh Div model. Set to a low priority because generally one will want a better representation, but allows arbitrary objects to be used as a Pane (numbers, arrays, objects, etc.).

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

panel.pane.markup.DivPaneBase: style

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread


media Module

Inheritance diagram of panel.pane.media

Contains Media panes including renderers for Audio and Video content.

class panel.pane.media.Audio(object=None, **params)[source]

Bases: panel.pane.media._MediaBase

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout

panel.pane.media._MediaBase: loop, time, throttle, paused, volume

object = param.ClassSelector(class_=(<class ‘str’>, <class ‘numpy.ndarray’>), default=’’)

The audio file either local or remote.

sample_rate = param.Integer(default=44100, inclusive_bounds=(True, True))

The sample_rate of the audio when given a NumPy array.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

class panel.pane.media.Video(object=None, **params)[source]

Bases: panel.pane.media._MediaBase

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout

panel.pane.media._MediaBase: object, loop, time, throttle, paused, volume

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread


plot Module

Inheritance diagram of panel.pane.plot

Pane class which render plots from different libraries

class panel.pane.plot.Bokeh(object=None, **params)[source]

Bases: panel.pane.base.PaneBase

Bokeh panes allow including any Bokeh model in a panel.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

class panel.pane.plot.Folium(object=None, **params)[source]

Bases: panel.pane.markup.HTML

The Folium pane wraps Folium map components.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy

panel.pane.base.PaneBase: default_layout, object

panel.pane.markup.DivPaneBase: style

sizing_mode = param.ObjectSelector(default=’stretch_width’, objects=[‘fixed’, ‘stretch_width’, ‘stretch_height’, ‘stretch_both’, ‘scale_width’, ‘scale_height’, ‘scale_both’, None])

How the component should size itself. This is a high-level setting for maintaining width and height of the component. To gain more fine grained control over sizing, use width_policy, height_policy and aspect_ratio instead (those take precedence over sizing_mode). "fixed" Component is not responsive. It will retain its original width and height regardless of any subsequent browser window resize events. "stretch_width" Component will responsively resize to stretch to the available width, without maintaining any aspect ratio. The height of the component depends on the type of the component and may be fixed or fit to component’s contents. "stretch_height" Component will responsively resize to stretch to the available height, without maintaining any aspect ratio. The width of the component depends on the type of the component and may be fixed or fit to component’s contents. "stretch_both" Component is completely responsive, independently in width and height, and will occupy all the available horizontal and vertical space, even if this changes the aspect ratio of the component. "scale_width" Component will responsively resize to stretch to the available width, while maintaining the original or provided aspect ratio. "scale_height" Component will responsively resize to stretch to the available height, while maintaining the original or provided aspect ratio. "scale_both" Component will responsively resize to both the available width and height, while maintaining the original or provided aspect ratio.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

class panel.pane.plot.Matplotlib(object=None, **params)[source]

Bases: panel.pane.image.PNG

A Matplotlib pane renders a matplotlib figure to png and wraps the base64 encoded data in a bokeh Div model. The size of the image in pixels is determined by scaling the size of the figure in inches by a dpi of 72, increasing the dpi therefore controls the resolution of the image not the displayed size.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

panel.pane.markup.DivPaneBase: style

panel.pane.image.ImageBase: alt_text, link_url, embed

dpi = param.Integer(bounds=(1, None), default=144, inclusive_bounds=(True, True))

Scales the dpi of the matplotlib figure.

tight = param.Boolean(bounds=(0, 1), default=False)

Automatically adjust the figure size to fit the subplots and other artist elements.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

class panel.pane.plot.RGGPlot(object=None, **params)[source]

Bases: panel.pane.image.PNG

An RGGPlot pane renders an r2py-based ggplot2 figure to png and wraps the base64-encoded data in a bokeh Div model.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

panel.pane.markup.DivPaneBase: style

panel.pane.image.ImageBase: alt_text, link_url, embed

width = param.Integer(bounds=(0, None), default=400, inclusive_bounds=(True, True))

The width of the component (in pixels). This can be either fixed or preferred width, depending on width sizing policy.

height = param.Integer(bounds=(0, None), default=400, inclusive_bounds=(True, True))

The height of the component (in pixels). This can be either fixed or preferred height, depending on height sizing policy.

dpi = param.Integer(bounds=(1, None), default=144, inclusive_bounds=(True, True))

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

class panel.pane.plot.YT(object=None, **params)[source]

Bases: panel.pane.markup.HTML

YT panes wrap plottable objects from the YT library. By default, the height and width are calculated by summing all contained plots, but can optionally be specified explicitly to provide additional space.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

panel.pane.markup.DivPaneBase: style

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread


plotly Module

Inheritance diagram of panel.pane.plotly

Defines a PlotlyPane which renders a plotly plot using PlotlyPlot bokeh model.

class panel.pane.plotly.Plotly(object=None, **params)[source]

Bases: panel.pane.base.PaneBase

Plotly panes allow rendering plotly Figures and traces.

For efficiency any array objects found inside a Figure are added to a ColumnDataSource which allows using binary transport to sync the figure on bokeh server and via Comms.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

click_data = param.Dict(class_=<class ‘dict’>)

Click callback data

clickannotation_data = param.Dict(class_=<class ‘dict’>)

Clickannotation callback data

config = param.Dict(class_=<class ‘dict’>)

Config data

hover_data = param.Dict(class_=<class ‘dict’>)

Hover callback data

relayout_data = param.Dict(class_=<class ‘dict’>)

Relayout callback data

restyle_data = param.List(bounds=(0, None), default=[])

Restyle callback data

selected_data = param.Dict(class_=<class ‘dict’>)

Selected callback data

viewport = param.Dict(class_=<class ‘dict’>)

Current viewport state

viewport_update_policy = param.Selector(default=’mouseup’, objects=[‘mouseup’, ‘continuous’, ‘throttle’])

Policy by which the viewport parameter is updated during user interactions. * “mouseup”: updates are synchronized when mouse button is released after panning * “continuous”: updates are synchronized continually while panning * “throttle”: updates are synchronized while panning, at intervals determined by the viewport_update_throttle parameter

viewport_update_throttle = param.Integer(bounds=(0, None), default=200, inclusive_bounds=(True, True))

Time interval in milliseconds at which viewport updates are synchronized when viewport_update_policy is “throttle”.

_render_count = param.Integer(default=0, inclusive_bounds=(True, True))

Number of renders, increment to trigger re-render

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread


streamz Module

Inheritance diagram of panel.pane.streamz

Renders Streamz Stream objects.

class panel.pane.streamz.Streamz(object=None, **params)[source]

Bases: panel.pane.base.ReplacementPane

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

always_watch = param.Boolean(bounds=(0, 1), default=False)

Whether to watch even when not displayed.

rate_limit = param.Number(bounds=(0, None), default=0.1, inclusive_bounds=(True, True))

The minimum interval between events.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread


vega Module

Inheritance diagram of panel.pane.vega
class panel.pane.vega.Vega(object=None, **params)[source]

Bases: panel.pane.base.PaneBase

Vega panes allow rendering Vega plots and traces.

For efficiency any array objects found inside a Figure are added to a ColumnDataSource which allows using binary transport to sync the figure on bokeh server and via Comms.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, width_policy, height_policy, sizing_mode

panel.pane.base.PaneBase: default_layout, object

margin = param.Parameter(default=(5, 5, 30, 5))

Allows to create additional space around the component. May be specified as a two-tuple of the form (vertical, horizontal) or a four-tuple (top, right, bottom, left).

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

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

classmethod applies(obj)[source]

Given the object return a boolean 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 priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

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.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.Row

embed(max_states=1000, max_opts=3, json=False, save_path='./', load_path=None, progress=True)

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

  • 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

classmethod get_pane_type(obj, **kwargs)

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) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None)

Returns the root model and applies pre-processing hooks

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

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

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

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 source object to those on the target 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 (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

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

  • 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 object to attributes on another object in Python. 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 (object) – The target object of the link.

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

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

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None)

Saves Panel objects to file.

Parameters
  • filename (string 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.

select(selector=None)

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=None)

Serves the object if in a panel serve 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)

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None)

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

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, websocket_origin=None, threaded=False, verbose=True, open=True, **kwargs)

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

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

  • 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.

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

  • 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

Returns

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

Return type

bokeh.server.Server or threading.Thread

panel.pane.vega.ds_as_cds(dataset)[source]

Converts Vega dataset into Bokeh ColumnDataSource data