layout Module

layout Module

Defines Layout classes which may be used to arrange panes and widgets in flexible ways to build complex dashboards.

class panel.layout.Column(*objects, **params)[source]

Bases: panel.layout.ListPanel

Vertical layout of Viewables.

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.layout.ListPanel: margin, objects, scroll

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

append(obj)

Appends an object to the layout.

Parameters

(object) (obj) –

clear()

Clears the objects on this layout.

clone(*objects, **params)

Makes a copy of the layout sharing the same parameters.

Parameters
  • objects (Objects to add to the cloned layout.) –

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

Returns

Return type

Cloned layout 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

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

extend(objects)

Extends the objects on this layout with a list.

Parameters

(list) (objects) –

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

insert(index, obj)

Inserts an object in the layout at the specified index.

Parameters
  • (int) (index) –

  • (object) (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.

pop(index)

Pops an item from the layout by index.

Parameters

(int) (index) –

pprint()

Prints a compositional repr of the class.

remove(obj)

Removes an object from the layout.

Parameters

(object) (obj) –

reverse()

Reverses the objects in the layout.

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.layout.Divider(**params)[source]

Bases: panel.viewable.Reactive

A Divider line

Parameters inherited from:

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

width_policy = param.ObjectSelector(default=’fit’, objects=[], readonly=True)

Describes how the component should maintain its width. "auto" Use component’s preferred sizing policy. "fixed" Use exactly width pixels. Component will overflow if it can’t fit in the available horizontal space. "fit" Use component’s preferred width (if set) and allow it to fit into the available horizontal space within the minimum and maximum width bounds (if set). Component’s width neither will be aggressively minimized nor maximized. "min" Use as little horizontal space as possible, not less than the minimum width (if set). The starting point is the preferred width (if set). The width of the component may shrink or grow depending on the parent layout, aspect management and other factors. "max" Use as much horizontal space as possible, not more than the maximum width (if set). The starting point is the preferred width (if set). The width of the component may shrink or grow depending on the parent layout, aspect management and other factors.

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

clone(**params)

Makes a copy of the object sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Viewable 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

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

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.layout.GridBox(*objects, **params)[source]

Bases: panel.layout.ListPanel

List-like Grid which wraps depending on the specified number of rows or columns.

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.layout.ListPanel: margin, objects, scroll

nrows = param.Integer(bounds=(0, None), inclusive_bounds=(True, True))

Number of rows to reflow the layout into.

ncols = param.Integer(bounds=(0, None), inclusive_bounds=(True, True))

Number of columns to reflow the layout into.

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

append(obj)

Appends an object to the layout.

Parameters

(object) (obj) –

clear()

Clears the objects on this layout.

clone(*objects, **params)

Makes a copy of the layout sharing the same parameters.

Parameters
  • objects (Objects to add to the cloned layout.) –

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

Returns

Return type

Cloned layout 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

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

extend(objects)

Extends the objects on this layout with a list.

Parameters

(list) (objects) –

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

insert(index, obj)

Inserts an object in the layout at the specified index.

Parameters
  • (int) (index) –

  • (object) (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.

pop(index)

Pops an item from the layout by index.

Parameters

(int) (index) –

pprint()

Prints a compositional repr of the class.

remove(obj)

Removes an object from the layout.

Parameters

(object) (obj) –

reverse()

Reverses the objects in the layout.

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.layout.GridSpec(**params)[source]

Bases: panel.layout.Panel

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

width = param.Integer(bounds=(0, None), default=600, 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=600, inclusive_bounds=(True, True))

The height of the component (in pixels). This can be either fixed or preferred height, depending on height sizing policy.

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

The dictionary of child objects that make up the grid.

mode = param.ObjectSelector(default=’warn’, objects=[‘warn’, ‘error’, ‘override’])

Whether to warn, error or simply override on overlapping assignment.

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

clone(**params)[source]

Makes a copy of the GridSpec sharing the same parameters.

Parameters

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

Returns

Return type

Cloned GridSpec 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

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

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.layout.HSpacer(**params)[source]

Bases: panel.layout.Spacer

Spacer which automatically fills all available horizontal 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 = param.Parameter(default=’stretch_width’, readonly=True)

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

clone(**params)

Makes a copy of the object sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Viewable 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

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

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.layout.ListPanel(*objects, **params)[source]

Bases: panel.layout.Panel

An abstract baseclass for Panel objects with list-like children.

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

margin = param.Parameter(default=0)

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

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

The list of child objects that make up the layout.

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

Whether to add scrollbars if the content overflows the size of the container.

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

append(obj)[source]

Appends an object to the layout.

Parameters

(object) (obj) –

clear()[source]

Clears the objects on this layout.

clone(*objects, **params)[source]

Makes a copy of the layout sharing the same parameters.

Parameters
  • objects (Objects to add to the cloned layout.) –

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

Returns

Return type

Cloned layout 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

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

extend(objects)[source]

Extends the objects on this layout with a list.

Parameters

(list) (objects) –

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

insert(index, obj)[source]

Inserts an object in the layout at the specified index.

Parameters
  • (int) (index) –

  • (object) (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.

pop(index)[source]

Pops an item from the layout by index.

Parameters

(int) (index) –

pprint()

Prints a compositional repr of the class.

remove(obj)[source]

Removes an object from the layout.

Parameters

(object) (obj) –

reverse()[source]

Reverses the objects in the layout.

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.layout.Panel(**params)[source]

Bases: panel.viewable.Reactive

Abstract baseclass for a layout of Viewables.

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

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

clone(**params)

Makes a copy of the object sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Viewable 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

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

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

class panel.layout.Row(*objects, **params)[source]

Bases: panel.layout.ListPanel

Horizontal layout of Viewables.

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.layout.ListPanel: margin, objects, scroll

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

append(obj)

Appends an object to the layout.

Parameters

(object) (obj) –

clear()

Clears the objects on this layout.

clone(*objects, **params)

Makes a copy of the layout sharing the same parameters.

Parameters
  • objects (Objects to add to the cloned layout.) –

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

Returns

Return type

Cloned layout 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

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

extend(objects)

Extends the objects on this layout with a list.

Parameters

(list) (objects) –

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

insert(index, obj)

Inserts an object in the layout at the specified index.

Parameters
  • (int) (index) –

  • (object) (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.

pop(index)

Pops an item from the layout by index.

Parameters

(int) (index) –

pprint()

Prints a compositional repr of the class.

remove(obj)

Removes an object from the layout.

Parameters

(object) (obj) –

reverse()

Reverses the objects in the layout.

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.layout.Spacer(**params)[source]

Bases: panel.viewable.Reactive

Empty object used to control formatting (using positive or negative 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

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

clone(**params)

Makes a copy of the object sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Viewable 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

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

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.layout.Tabs(*items, **params)[source]

Bases: panel.layout.ListPanel

Panel of Viewables to be displayed in separate tabs.

Parameters inherited from:

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

panel.layout.ListPanel: margin, scroll

width = param.Integer(bounds=(0, None), 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), inclusive_bounds=(True, True))

The height of the component (in pixels). This can be either fixed or preferred height, depending on height sizing policy.

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

The list of child objects that make up the tabs.

active = param.Integer(bounds=(0, None), default=0, inclusive_bounds=(True, True))

Number of the currently active tab.

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

Whether it should be possible to close tabs.

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

Dynamically populate only the active tab.

tabs_location = param.ObjectSelector(default=’above’, objects=[‘above’, ‘below’, ‘left’, ‘right’])

The location of the tabs relative to the tab contents.

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

append(pane)[source]

Appends an object to the tabs.

Parameters

(object) (obj) –

clear()[source]

Clears the tabs.

clone(*objects, **params)[source]

Makes a copy of the Tabs sharing the same parameters.

Parameters
  • objects (Objects to add to the cloned Tabs object.) –

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

Returns

Return type

Cloned Tabs 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

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

extend(panes)[source]

Extends the the tabs with a list.

Parameters

(list) (objects) –

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

insert(index, pane)[source]

Inserts an object in the tabs at the specified index.

Parameters
  • (int) (index) –

  • (object) (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.

pop(index)[source]

Pops an item from the tabs by index.

Parameters

(int) (index) –

pprint()

Prints a compositional repr of the class.

remove(pane)[source]

Removes an object from the tabs.

Parameters

(object) (obj) –

reverse()[source]

Reverses the tabs.

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.layout.VSpacer(**params)[source]

Bases: panel.layout.Spacer

Spacer which automatically fills all available vertical 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 = param.Parameter(default=’stretch_height’, readonly=True)

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

clone(**params)

Makes a copy of the object sharing the same parameters.

Parameters

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

Returns

Return type

Cloned Viewable 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

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

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.layout.WidgetBox(*objects, **params)[source]

Bases: panel.layout.ListPanel

Vertical layout of widgets.

Parameters inherited from:

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

panel.layout.ListPanel: objects, scroll

css_classes = param.List(bounds=(0, None), default=[‘widget-box’])

CSS classes to apply to the layout.

margin = param.Parameter(default=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).

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

Whether the widget is disabled.

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

Whether to lay out the widgets in a Row layout as opposed to a Column layout.

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

append(obj)

Appends an object to the layout.

Parameters

(object) (obj) –

clear()

Clears the objects on this layout.

clone(*objects, **params)

Makes a copy of the layout sharing the same parameters.

Parameters
  • objects (Objects to add to the cloned layout.) –

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

Returns

Return type

Cloned layout 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

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

extend(objects)

Extends the objects on this layout with a list.

Parameters

(list) (objects) –

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

insert(index, obj)

Inserts an object in the layout at the specified index.

Parameters
  • (int) (index) –

  • (object) (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.

pop(index)

Pops an item from the layout by index.

Parameters

(int) (index) –

pprint()

Prints a compositional repr of the class.

remove(obj)

Removes an object from the layout.

Parameters

(object) (obj) –

reverse()

Reverses the objects in the layout.

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