Renderers for various kinds of annotations that can be added to plots.
Bases: CustomDimensional
Units of angular measurement.
{ "basis": { "entries": [ [ "\u00b0", [ 1, "^\\circ", "degree" ] ], [ "'", [ 0.016666666666666666, "^\\prime", "minute" ] ], [ "''", [ 0.0002777777777777778, "^{\\prime\\prime}", "second" ] ] ], "type": "map" }, "exclude": [], "id": "p52966", "include": null, "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "name": null, "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "ticks": [ 1, 3, 6, 12, 60, 120, 240, 360 ] }
The basis defining the units of measurement.
This consists of a mapping between short unit names and their corresponding scaling factors, TeX names and optional long names. For example, the basis for defining angular units of measurement is:
basis = { "°": (1, "^\circ", "degree"), "'": (1/60, "^\prime", "minute"), "''": (1/3600, "^{\prime\prime}", "second"), }
A subset of units from the basis to avoid.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Preferred values to choose from in non-exact mode.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: CompositeRenderer
Base class for all annotation models.
Note
This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.
{ "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "elements": [], "group": null, "html_attributes": { "type": "map" }, "html_id": null, "id": "p52974", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "annotation", "name": null, "propagate_hover": false, "renderers": [], "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "visible": true, "x_range_name": "default", "y_range_name": "default" }
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: DataAnnotation
Render arrows as an annotation.
See Arrows for information on plotting arrows.
{ "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "elements": [], "end": { "id": "p52997", "name": "OpenHead", "type": "object" }, "end_units": "data", "group": null, "html_attributes": { "type": "map" }, "html_id": null, "id": "p52993", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "annotation", "line_alpha": { "type": "value", "value": 1.0 }, "line_cap": { "type": "value", "value": "butt" }, "line_color": { "type": "value", "value": "black" }, "line_dash": { "type": "value", "value": [] }, "line_dash_offset": { "type": "value", "value": 0 }, "line_join": { "type": "value", "value": "bevel" }, "line_width": { "type": "value", "value": 1 }, "name": null, "propagate_hover": false, "renderers": [], "source": { "attributes": { "data": { "type": "map" }, "selected": { "attributes": { "indices": [], "line_indices": [] }, "id": "p52995", "name": "Selection", "type": "object" }, "selection_policy": { "id": "p52996", "name": "UnionRenderers", "type": "object" } }, "id": "p52994", "name": "ColumnDataSource", "type": "object" }, "start": null, "start_units": "data", "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "visible": true, "x_end": { "field": "x_end", "type": "field" }, "x_range_name": "default", "x_start": { "field": "x_start", "type": "field" }, "y_end": { "field": "y_end", "type": "field" }, "y_range_name": "default", "y_start": { "field": "y_start", "type": "field" } }
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
The unit type for the end_x and end_y attributes. Interpreted as âdata spaceâ units by default.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
The line alpha values for the arrow body.
LineCapSpec
The line cap values for the arrow body.
The line color values for the arrow body.
DashPatternSpec
The line dash values for the arrow body.
IntSpec
The line dash offset values for the arrow body.
LineJoinSpec
The line join values for the arrow body.
The line width values for the arrow body.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Local data source to use when rendering annotations on the plot.
The unit type for the start_x and start_y attributes. Interpreted as âdata spaceâ units by default.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Is the renderer visible.
The x-coordinates to locate the end of the arrows.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
The x-coordinates to locate the start of the arrows.
The y-coordinates to locate the end of the arrows.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
The y-coordinates to locate the start of the arrows.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: Marking
Base class for arrow heads.
Note
This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.
{ "id": "p53172", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "name": null, "size": { "type": "value", "value": 25 }, "subscribed_events": { "type": "set" }, "syncable": true, "tags": [] }
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
The size, in pixels, of the arrow head.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: DataAnnotation
Render a filled area band along a dimension.
See Bands for information on plotting bands.
{ "base": { "field": "base", "type": "field" }, "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "dimension": "height", "elements": [], "fill_alpha": 0.4, "fill_color": "#fff9ba", "group": null, "hatch_alpha": 1.0, "hatch_color": "black", "hatch_extra": { "type": "map" }, "hatch_pattern": null, "hatch_scale": 12.0, "hatch_weight": 1.0, "html_attributes": { "type": "map" }, "html_id": null, "id": "p53177", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "annotation", "line_alpha": 0.3, "line_cap": "butt", "line_color": "#cccccc", "line_dash": [], "line_dash_offset": 0, "line_join": "bevel", "line_width": 1, "lower": { "field": "lower", "type": "field" }, "name": null, "propagate_hover": false, "renderers": [], "source": { "attributes": { "data": { "type": "map" }, "selected": { "attributes": { "indices": [], "line_indices": [] }, "id": "p53179", "name": "Selection", "type": "object" }, "selection_policy": { "id": "p53180", "name": "UnionRenderers", "type": "object" } }, "id": "p53178", "name": "ColumnDataSource", "type": "object" }, "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "upper": { "field": "upper", "type": "field" }, "visible": true, "x_range_name": "default", "y_range_name": "default" }
The orthogonal coordinates of the upper and lower values.
Units to use for the associated property: canvas, screen or data
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
The direction of the band can be specified by setting this property to âheightâ (y
direction) or âwidthâ (x
direction).
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
The fill alpha values for the band.
Note
This property is experimental and may change at any point.
The hatch alpha values for the band.
The hatch scale values for the band.
The hatch weight values for the band.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
The line alpha values for the band.
The line dash values for the band.
The line dash offset values for the band.
The line width values for the band.
The coordinates of the lower portion of the filled area band.
Units to use for the associated property: canvas, screen or data
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Local data source to use when rendering annotations on the plot.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
The coordinates of the upper portion of the filled area band.
Units to use for the associated property: canvas, screen or data
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: Annotation
, AreaVisuals
Render a shaded rectangular region as an annotation.
See Box annotations for information on plotting box annotations.
{ "border_radius": 0, "bottom": { "attributes": { "symbol": "bottom", "target": "frame" }, "id": "p53352", "name": "Node", "type": "object" }, "bottom_limit": null, "bottom_units": "data", "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "editable": false, "elements": [], "fill_alpha": 0.4, "fill_color": "#fff9ba", "group": null, "handles": { "attributes": { "all": { "attributes": { "fill_color": "white", "hover_fill_color": "lightgray" }, "id": "p53353", "name": "AreaVisuals", "type": "object" } }, "id": "p53354", "name": "BoxInteractionHandles", "type": "object" }, "hatch_alpha": 1.0, "hatch_color": "black", "hatch_extra": { "type": "map" }, "hatch_pattern": null, "hatch_scale": 12.0, "hatch_weight": 1.0, "hover_fill_alpha": 0.4, "hover_fill_color": null, "hover_hatch_alpha": 1.0, "hover_hatch_color": "black", "hover_hatch_extra": { "type": "map" }, "hover_hatch_pattern": null, "hover_hatch_scale": 12.0, "hover_hatch_weight": 1.0, "hover_line_alpha": 0.3, "hover_line_cap": "butt", "hover_line_color": null, "hover_line_dash": [], "hover_line_dash_offset": 0, "hover_line_join": "bevel", "hover_line_width": 1, "html_attributes": { "type": "map" }, "html_id": null, "id": "p53348", "inverted": false, "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "left": { "attributes": { "symbol": "left", "target": "frame" }, "id": "p53349", "name": "Node", "type": "object" }, "left_limit": null, "left_units": "data", "level": "annotation", "line_alpha": 0.3, "line_cap": "butt", "line_color": "#cccccc", "line_dash": [], "line_dash_offset": 0, "line_join": "bevel", "line_width": 1, "max_height": { "type": "number", "value": "+inf" }, "max_width": { "type": "number", "value": "+inf" }, "min_height": 0, "min_width": 0, "movable": "both", "name": null, "propagate_hover": false, "renderers": [], "resizable": "all", "right": { "attributes": { "symbol": "right", "target": "frame" }, "id": "p53350", "name": "Node", "type": "object" }, "right_limit": null, "right_units": "data", "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "symmetric": false, "syncable": true, "tags": [], "top": { "attributes": { "symbol": "top", "target": "frame" }, "id": "p53351", "name": "Node", "type": "object" }, "top_limit": null, "top_units": "data", "use_handles": false, "visible": true, "x_range_name": "default", "y_range_name": "default" }
Either
(NonNegative
, Tuple
(NonNegative
, NonNegative
, NonNegative
, NonNegative
), Struct
)
Allows the box to have rounded corners.
Note
This property is experimental and may change at any point.
The y-coordinates of the bottom edge of the box annotation.
Optional bottom limit for box movement.
Note
This property is experimental and may change at any point.
The unit type for the bottom attribute. Interpreted as data units by default. This doesnât have any effect if bottom
is a node.
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
Allows to interactively modify the geometry of this box.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
The fill alpha values for the box.
Note
This property is experimental and may change at any point.
Configure appearance of interaction handles.
Handles can be configured in bulk in an increasing level of specificity, were each level, if defined, overrides the more generic setting:
all -> move, resize
resize -> sides, corners
sides -> left, right, top, bottom
corners -> top_left, top_right, bottom_left, bottom_right
Note
This property is experimental and may change at any point.
The hatch alpha values for the box.
The hatch scale values for the box.
The hatch weight values for the box.
The fill alpha values for the box when hovering over.
The fill color values for the box when hovering over.
The hatch alpha values for the box when hovering over.
The hatch color values for the box when hovering over.
The hatch pattern values for the box when hovering over.
The hatch scale values for the box when hovering over.
The hatch weight values for the box when hovering over.
The line alpha values for the box when hovering over.
The line color values for the box when hovering over.
The line dash values for the box when hovering over.
The line dash offset values for the box when hovering over.
The line join values for the box when hovering over.
The line width values for the box when hovering over.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Inverts the geometry of the box, i.e. applies fill and hatch visuals to the outside of the box instead of the inside. Visuals are applied between the box and its parent, e.g. the frame.
The x-coordinates of the left edge of the box annotation.
Optional left limit for box movement.
Note
This property is experimental and may change at any point.
The unit type for the left attribute. Interpreted as data units by default. This doesnât have any effect if left
is a node.
Specifies the level in which to paint this renderer.
The line alpha values for the box.
The line dash values for the box.
The line dash offset values for the box.
The line width values for the box.
Allows to set the maximum height of the box.
Note
This property is experimental and may change at any point.
Allows to set the minimum height of the box.
Note
This property is experimental and may change at any point.
Allows to set the maximum width of the box.
Note
This property is experimental and may change at any point.
Allows to set the minimum width of the box.
Note
This property is experimental and may change at any point.
If editable
is set, this property allows to configure in which directions the box can be moved.
Note
This property is experimental and may change at any point.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
If editable
is set, this property allows to configure which combinations of edges are allowed to be moved, thus allows restrictions on resizing of the box.
Note
This property is experimental and may change at any point.
The x-coordinates of the right edge of the box annotation.
Optional right limit for box movement.
Note
This property is experimental and may change at any point.
The unit type for the right attribute. Interpreted as data units by default. This doesnât have any effect if right
is a node.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether the box is resizable around its center or its corners.
Note
This property is experimental and may change at any point.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
The y-coordinates of the top edge of the box annotation.
Optional top limit for box movement.
Note
This property is experimental and may change at any point.
The unit type for the top attribute. Interpreted as data units by default. This doesnât have any effect if top
is a node.
Whether to show interaction (move, resize, etc.) handles.
If handles arenât used, then the whole annotation, its borders and corners act as if they were interaction handles.
Note
This property is experimental and may change at any point.
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: Model
Defines interaction handles for box-like annotations.
{ "all": { "name": "unset", "type": "symbol" }, "bottom": null, "bottom_left": null, "bottom_right": null, "corners": null, "id": "p53865", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "left": null, "move": null, "name": null, "resize": null, "right": null, "sides": null, "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "top": null, "top_left": null, "top_right": null }
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: BaseColorBar
Render a color bar based on a color mapper.
See Color bars for information on plotting color bars.
{ "background_fill_alpha": 0.95, "background_fill_color": "#ffffff", "background_hatch_alpha": 1.0, "background_hatch_color": "black", "background_hatch_extra": { "type": "map" }, "background_hatch_pattern": null, "background_hatch_scale": 12.0, "background_hatch_weight": 1.0, "bar_line_alpha": 1.0, "bar_line_cap": "butt", "bar_line_color": null, "bar_line_dash": [], "bar_line_dash_offset": 0, "bar_line_join": "bevel", "bar_line_width": 1, "border_line_alpha": 1.0, "border_line_cap": "butt", "border_line_color": null, "border_line_dash": [], "border_line_dash_offset": 0, "border_line_join": "bevel", "border_line_width": 1, "color_mapper": { "name": "unset", "type": "symbol" }, "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "display_high": null, "display_low": null, "elements": [], "formatter": "auto", "group": null, "height": "auto", "html_attributes": { "type": "map" }, "html_id": null, "id": "p53869", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "label_standoff": 5, "level": "annotation", "location": "top_right", "major_label_overrides": { "type": "map" }, "major_label_policy": { "id": "p53870", "name": "NoOverlap", "type": "object" }, "major_label_text_align": "left", "major_label_text_alpha": 1.0, "major_label_text_baseline": "bottom", "major_label_text_color": "#444444", "major_label_text_font": "helvetica", "major_label_text_font_size": "11px", "major_label_text_font_style": "normal", "major_label_text_line_height": 1.2, "major_label_text_outline_color": null, "major_tick_in": 5, "major_tick_line_alpha": 1.0, "major_tick_line_cap": "butt", "major_tick_line_color": "#ffffff", "major_tick_line_dash": [], "major_tick_line_dash_offset": 0, "major_tick_line_join": "bevel", "major_tick_line_width": 1, "major_tick_out": 0, "margin": 30, "minor_tick_in": 0, "minor_tick_line_alpha": 1.0, "minor_tick_line_cap": "butt", "minor_tick_line_color": null, "minor_tick_line_dash": [], "minor_tick_line_dash_offset": 0, "minor_tick_line_join": "bevel", "minor_tick_line_width": 1, "minor_tick_out": 0, "name": null, "orientation": "auto", "padding": 10, "propagate_hover": false, "renderers": [], "scale_alpha": 1.0, "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "ticker": "auto", "title": null, "title_standoff": 2, "title_text_align": "left", "title_text_alpha": 1.0, "title_text_baseline": "bottom", "title_text_color": "#444444", "title_text_font": "helvetica", "title_text_font_size": "13px", "title_text_font_style": "italic", "title_text_line_height": 1.2, "title_text_outline_color": null, "visible": true, "width": "auto", "x_range_name": "default", "y_range_name": "default" }
The fill alpha for the color bar background style.
The fill color for the color bar background style.
The hatch alpha for the color bar background style.
The hatch color for the color bar background style.
The hatch pattern for the color bar background style.
The hatch scale for the color bar background style.
The hatch weight for the color bar background style.
The line alpha for the color scale bar outline.
The line dash for the color scale bar outline.
The line dash offset for the color scale bar outline.
The line width for the color scale bar outline.
The line alpha for the color bar border outline.
The line dash for the color bar border outline.
The line dash offset for the color bar border outline.
The line width for the color bar border outline.
A color mapper containing a color palette to render.
Warning
If the low and high attributes of the ColorMapper
arenât set, ticks and tick labels wonât be rendered. Additionally, if a LogTicker
is passed to the ticker argument and either or both of the logarithms of low and high values of the color_mapper are non-numeric (i.e. low=0), the tick and tick labels wonât be rendered.
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
The highest value to display in the color bar. The whole of the color entry containing this value is shown.
The lowest value to display in the color bar. The whole of the color entry containing this value is shown.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
A TickFormatter
to use for formatting the visual appearance of ticks.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
The distance (in pixels) to separate the tick labels from the color bar.
Specifies the level in which to paint this renderer.
The location where the color bar should draw itself. Itâs either one of bokeh.core.enums.Anchor
âs enumerated values, or a (x, y)
tuple indicating an absolute location absolute location in screen coordinates (pixels from the bottom-left corner).
Warning
If the color bar is placed in a side panel, the location will likely have to be set to (0,0).
Provide explicit tick label values for specific tick locations that override normal formatting.
Instance
(LabelingPolicy
)
Allows to filter out labels, e.g. declutter labels to avoid overlap.
The text alpha of the major tick labels.
The text baseline of the major tick labels.
The text font of the major tick labels.
The text font size of the major tick labels.
The text font style of the major tick labels.
The text line height of the major tick labels.
The text outline color of the major tick labels.
The distance (in pixels) that major ticks should extend into the main plot area.
The line alpha of the major ticks.
The line dash of the major ticks.
The line dash offset of the major ticks.
The line width of the major ticks.
The distance (in pixels) that major ticks should extend out of the main plot area.
Amount of margin (in pixels) around the outside of the color bar.
The distance (in pixels) that minor ticks should extend into the main plot area.
The line alpha of the minor ticks.
The line dash of the minor ticks.
The line dash offset of the minor ticks.
The line width of the minor ticks.
The distance (in pixels) that major ticks should extend out of the main plot area.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Whether the color bar should be oriented vertically or horizontally.
Amount of padding (in pixels) between the color scale and color bar border.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
The alpha with which to render the color scale.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
A Ticker to use for computing locations of axis components.
Nullable
(TextLike
)
The title text to render.
The distance (in pixels) to separate the title from the color bar.
The text alpha values for the title text.
The text baseline values for the title text.
The text font values for the title text.
The text font size values for the title text.
The text font style values for the title text.
The text line height values for the title text.
The text outline color values for the title text.
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: BaseColorBar
Color bar used for contours.
Supports displaying hatch patterns and line styles that contour plots may have as well as the usual fill styles.
Do not create these objects manually, instead use ContourRenderer.color_bar
.
{ "background_fill_alpha": 0.95, "background_fill_color": "#ffffff", "background_hatch_alpha": 1.0, "background_hatch_color": "black", "background_hatch_extra": { "type": "map" }, "background_hatch_pattern": null, "background_hatch_scale": 12.0, "background_hatch_weight": 1.0, "bar_line_alpha": 1.0, "bar_line_cap": "butt", "bar_line_color": null, "bar_line_dash": [], "bar_line_dash_offset": 0, "bar_line_join": "bevel", "bar_line_width": 1, "border_line_alpha": 1.0, "border_line_cap": "butt", "border_line_color": null, "border_line_dash": [], "border_line_dash_offset": 0, "border_line_join": "bevel", "border_line_width": 1, "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "elements": [], "fill_renderer": { "name": "unset", "type": "symbol" }, "formatter": "auto", "group": null, "height": "auto", "html_attributes": { "type": "map" }, "html_id": null, "id": "p54058", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "label_standoff": 5, "level": "annotation", "levels": [], "line_renderer": { "name": "unset", "type": "symbol" }, "location": "top_right", "major_label_overrides": { "type": "map" }, "major_label_policy": { "id": "p54059", "name": "NoOverlap", "type": "object" }, "major_label_text_align": "left", "major_label_text_alpha": 1.0, "major_label_text_baseline": "bottom", "major_label_text_color": "#444444", "major_label_text_font": "helvetica", "major_label_text_font_size": "11px", "major_label_text_font_style": "normal", "major_label_text_line_height": 1.2, "major_label_text_outline_color": null, "major_tick_in": 5, "major_tick_line_alpha": 1.0, "major_tick_line_cap": "butt", "major_tick_line_color": "#ffffff", "major_tick_line_dash": [], "major_tick_line_dash_offset": 0, "major_tick_line_join": "bevel", "major_tick_line_width": 1, "major_tick_out": 0, "margin": 30, "minor_tick_in": 0, "minor_tick_line_alpha": 1.0, "minor_tick_line_cap": "butt", "minor_tick_line_color": null, "minor_tick_line_dash": [], "minor_tick_line_dash_offset": 0, "minor_tick_line_join": "bevel", "minor_tick_line_width": 1, "minor_tick_out": 0, "name": null, "orientation": "auto", "padding": 10, "propagate_hover": false, "renderers": [], "scale_alpha": 1.0, "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "ticker": "auto", "title": null, "title_standoff": 2, "title_text_align": "left", "title_text_alpha": 1.0, "title_text_baseline": "bottom", "title_text_color": "#444444", "title_text_font": "helvetica", "title_text_font_size": "13px", "title_text_font_style": "italic", "title_text_line_height": 1.2, "title_text_outline_color": null, "visible": true, "width": "auto", "x_range_name": "default", "y_range_name": "default" }
The fill alpha for the color bar background style.
The fill color for the color bar background style.
The hatch alpha for the color bar background style.
The hatch color for the color bar background style.
The hatch pattern for the color bar background style.
The hatch scale for the color bar background style.
The hatch weight for the color bar background style.
The line alpha for the color scale bar outline.
The line dash for the color scale bar outline.
The line dash offset for the color scale bar outline.
The line width for the color scale bar outline.
The line alpha for the color bar border outline.
The line dash for the color bar border outline.
The line dash offset for the color bar border outline.
The line width for the color bar border outline.
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
Glyph renderer used for filled contour polygons.
A TickFormatter
to use for formatting the visual appearance of ticks.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
The distance (in pixels) to separate the tick labels from the color bar.
Specifies the level in which to paint this renderer.
Glyph renderer used for contour lines.
The location where the color bar should draw itself. Itâs either one of bokeh.core.enums.Anchor
âs enumerated values, or a (x, y)
tuple indicating an absolute location absolute location in screen coordinates (pixels from the bottom-left corner).
Warning
If the color bar is placed in a side panel, the location will likely have to be set to (0,0).
Provide explicit tick label values for specific tick locations that override normal formatting.
Instance
(LabelingPolicy
)
Allows to filter out labels, e.g. declutter labels to avoid overlap.
The text alpha of the major tick labels.
The text baseline of the major tick labels.
The text font of the major tick labels.
The text font size of the major tick labels.
The text font style of the major tick labels.
The text line height of the major tick labels.
The text outline color of the major tick labels.
The distance (in pixels) that major ticks should extend into the main plot area.
The line alpha of the major ticks.
The line dash of the major ticks.
The line dash offset of the major ticks.
The line width of the major ticks.
The distance (in pixels) that major ticks should extend out of the main plot area.
Amount of margin (in pixels) around the outside of the color bar.
The distance (in pixels) that minor ticks should extend into the main plot area.
The line alpha of the minor ticks.
The line dash of the minor ticks.
The line dash offset of the minor ticks.
The line width of the minor ticks.
The distance (in pixels) that major ticks should extend out of the main plot area.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Whether the color bar should be oriented vertically or horizontally.
Amount of padding (in pixels) between the color scale and color bar border.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
The alpha with which to render the color scale.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
A Ticker to use for computing locations of axis components.
Nullable
(TextLike
)
The title text to render.
The distance (in pixels) to separate the title from the color bar.
The text alpha values for the title text.
The text baseline values for the title text.
The text font values for the title text.
The text font size values for the title text.
The text font style values for the title text.
The text line height values for the title text.
The text outline color values for the title text.
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: Annotation
Base class for HTML-based annotations.
Note
All annotations that inherit from this base class can be attached to a canvas, but are not rendered to it, thus they wonât appear in saved plots. Only export_png()
function can preserve HTML annotations.
Note
This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.
{ "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "elements": [], "group": null, "html_attributes": { "type": "map" }, "html_id": null, "id": "p54247", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "annotation", "name": null, "propagate_hover": false, "renderers": [], "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "visible": true, "x_range_name": "default", "y_range_name": "default" }
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: HTMLTextAnnotation
Render a single HTML label as an annotation.
Label
will render a single text label at given x
and y
coordinates, which can be in either screen (pixel) space, or data (axis range) space.
The label can also be configured with a screen space offset from x
and y
, by using the x_offset
and y_offset
properties.
Additionally, the label can be rotated with the angle
property.
There are also standard text, fill, and line properties to control the appearance of the text, its background, as well as the rectangular bounding box border.
See Labels for information on plotting labels.
{ "angle": 0, "angle_units": "rad", "background_fill_alpha": 1.0, "background_fill_color": null, "background_hatch_alpha": 1.0, "background_hatch_color": null, "background_hatch_extra": { "type": "map" }, "background_hatch_pattern": null, "background_hatch_scale": 12.0, "background_hatch_weight": 1.0, "border_line_alpha": 1.0, "border_line_cap": "butt", "border_line_color": null, "border_line_dash": [], "border_line_dash_offset": 0, "border_line_join": "bevel", "border_line_width": 1, "border_radius": 0, "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "elements": [], "group": null, "html_attributes": { "type": "map" }, "html_id": null, "id": "p54266", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "annotation", "name": null, "padding": 0, "propagate_hover": false, "renderers": [], "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "text": "", "text_align": "left", "text_alpha": 1.0, "text_baseline": "bottom", "text_color": "#444444", "text_font": "helvetica", "text_font_size": "16px", "text_font_style": "normal", "text_line_height": 1.2, "text_outline_color": null, "visible": true, "x": { "name": "unset", "type": "symbol" }, "x_offset": 0, "x_range_name": "default", "x_units": "data", "y": { "name": "unset", "type": "symbol" }, "y_offset": 0, "y_range_name": "default", "y_units": "data" }
The angle to rotate the text, as measured from the horizontal.
Acceptable values for units are "rad"
and "deg"
The fill alpha values for the text bounding box.
The fill color values for the text bounding box.
The hatch alpha values for the text bounding box.
The hatch color values for the text bounding box.
The hatch pattern values for the text bounding box.
The hatch scale values for the text bounding box.
The hatch weight values for the text bounding box.
The line alpha values for the text bounding box.
The line dash values for the text bounding box.
The line dash offset values for the text bounding box.
The line width values for the text bounding box.
Either
(NonNegative
, Tuple
(NonNegative
, NonNegative
, NonNegative
, NonNegative
), Struct
)
Allows labelâs box to have rounded corners. For the best results, it should be used in combination with padding
.
Note
This property is experimental and may change at any point.
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Either
(NonNegative
, Tuple
(NonNegative
, NonNegative
), Struct
, Tuple
(NonNegative
, NonNegative
, NonNegative
, NonNegative
), Struct
)
Extra space between the text of a label and its bounding box (border).
Note
This property is experimental and may change at any point.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
The text value to render.
The text alpha values for the text.
The text baseline values for the text.
The text font values for the text.
The text font size values for the text.
The text line height values for the text.
Is the renderer visible.
The x-coordinate in screen coordinates to locate the text anchors.
Offset value to apply to the x-coordinate.
This is useful, for instance, if it is desired to âfloatâ text a fixed distance in screen units from a given data position.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
The unit type for the x attribute. Interpreted as data units by default.
The y-coordinate in screen coordinates to locate the text anchors.
Offset value to apply to the y-coordinate.
This is useful, for instance, if it is desired to âfloatâ text a fixed distance in screen units from a given data position.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
The unit type for the y attribute. Interpreted as data units by default.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: HTMLAnnotation
, DataAnnotation
Render multiple text labels as annotations.
LabelSet
will render multiple text labels at given x
and y
coordinates, which can be in either screen (pixel) space, or data (axis range) space. In this case (as opposed to the single Label
model), x
and y
can also be the name of a column from a ColumnDataSource
, in which case the labels will be âvectorizedâ using coordinate values from the specified columns.
The label can also be configured with a screen space offset from x
and y
, by using the x_offset
and y_offset
properties. These offsets may be vectorized by giving the name of a data source column.
Additionally, the label can be rotated with the angle
property (which may also be a column name.)
There are also standard text, fill, and line properties to control the appearance of the text, its background, as well as the rectangular bounding box border.
The data source is provided by setting the source
property.
{ "angle": { "type": "value", "value": 0 }, "background_fill_alpha": { "type": "value", "value": 1.0 }, "background_fill_color": { "type": "value", "value": null }, "border_line_alpha": { "type": "value", "value": 1.0 }, "border_line_cap": { "type": "value", "value": "butt" }, "border_line_color": { "type": "value", "value": null }, "border_line_dash": { "type": "value", "value": [] }, "border_line_dash_offset": { "type": "value", "value": 0 }, "border_line_join": { "type": "value", "value": "bevel" }, "border_line_width": { "type": "value", "value": 1 }, "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "elements": [], "group": null, "html_attributes": { "type": "map" }, "html_id": null, "id": "p54320", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "annotation", "name": null, "propagate_hover": false, "renderers": [], "source": { "attributes": { "data": { "type": "map" }, "selected": { "attributes": { "indices": [], "line_indices": [] }, "id": "p54322", "name": "Selection", "type": "object" }, "selection_policy": { "id": "p54323", "name": "UnionRenderers", "type": "object" } }, "id": "p54321", "name": "ColumnDataSource", "type": "object" }, "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "text": { "field": "text", "type": "field" }, "text_align": { "type": "value", "value": "left" }, "text_alpha": { "type": "value", "value": 1.0 }, "text_baseline": { "type": "value", "value": "bottom" }, "text_color": { "type": "value", "value": "#444444" }, "text_font": { "type": "value", "value": "helvetica" }, "text_font_size": { "type": "value", "value": "16px" }, "text_font_style": { "type": "value", "value": "normal" }, "text_line_height": { "type": "value", "value": 1.2 }, "text_outline_color": { "type": "value", "value": null }, "visible": true, "x": { "field": "x", "type": "field" }, "x_offset": { "type": "value", "value": 0 }, "x_range_name": "default", "x_units": "data", "y": { "field": "y", "type": "field" }, "y_offset": { "type": "value", "value": 0 }, "y_range_name": "default", "y_units": "data" }
The angles to rotate the text, as measured from the horizontal.
Units to use for the associated property: deg, rad, grad or turn
The fill alpha values for the text bounding box.
The fill color values for the text bounding box.
The line alpha values for the text bounding box.
LineCapSpec
The line cap values for the text bounding box.
The line color values for the text bounding box.
DashPatternSpec
The line dash values for the text bounding box.
IntSpec
The line dash offset values for the text bounding box.
LineJoinSpec
The line join values for the text bounding box.
The line width values for the text bounding box.
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Local data source to use when rendering annotations on the plot.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
NullStringSpec
The text values to render.
TextAlignSpec
The text align values for the text.
The text alpha values for the text.
TextBaselineSpec
The text baseline values for the text.
The text color values for the text.
The text font values for the text.
The text font size values for the text.
FontStyleSpec
The text font style values for the text.
The text line height values for the text.
The text outline color values for the text.
Is the renderer visible.
The x-coordinates to locate the text anchors.
Offset values to apply to the x-coordinates.
This is useful, for instance, if it is desired to âfloatâ text a fixed distance in screen units from a given data position.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
The unit type for the xs
attribute. Interpreted as data units by default.
The y-coordinates to locate the text anchors.
Offset values to apply to the y-coordinates.
This is useful, for instance, if it is desired to âfloatâ text a fixed distance in screen units from a given data position.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
The unit type for the ys
attribute. Interpreted as data units by default.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: HTMLTextAnnotation
Render a single title box as an annotation.
See Titles for information on plotting titles.
{ "align": "left", "background_fill_alpha": 1.0, "background_fill_color": null, "background_hatch_alpha": 1.0, "background_hatch_color": null, "background_hatch_extra": { "type": "map" }, "background_hatch_pattern": null, "background_hatch_scale": 12.0, "background_hatch_weight": 1.0, "border_line_alpha": 1.0, "border_line_cap": "butt", "border_line_color": null, "border_line_dash": [], "border_line_dash_offset": 0, "border_line_join": "bevel", "border_line_width": 1, "border_radius": 0, "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "elements": [], "group": null, "html_attributes": { "type": "map" }, "html_id": null, "id": "p54511", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "annotation", "name": null, "offset": 0, "padding": 0, "propagate_hover": false, "renderers": [], "standoff": 10, "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "text": "", "text_alpha": 1.0, "text_color": "#444444", "text_font": "helvetica", "text_font_size": "13px", "text_font_style": "bold", "text_line_height": 1.0, "text_outline_color": null, "vertical_align": "bottom", "visible": true, "x_range_name": "default", "y_range_name": "default" }
Alignment of the text in its enclosing space, along the direction of the text.
The fill alpha values for the text bounding box.
The fill color values for the text bounding box.
The hatch alpha values for the text bounding box.
The hatch color values for the text bounding box.
The hatch pattern values for the text bounding box.
The hatch scale values for the text bounding box.
The hatch weight values for the text bounding box.
The line alpha values for the text bounding box.
The line dash values for the text bounding box.
The line dash offset values for the text bounding box.
The line width values for the text bounding box.
Either
(NonNegative
, Tuple
(NonNegative
, NonNegative
, NonNegative
, NonNegative
), Struct
)
Allows labelâs box to have rounded corners. For the best results, it should be used in combination with padding
.
Note
This property is experimental and may change at any point.
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Offset the text by a number of pixels (can be positive or negative). Shifts the text in different directions based on the location of the title:
above: shifts title right
right: shifts title down
below: shifts title right
left: shifts title up
Either
(NonNegative
, Tuple
(NonNegative
, NonNegative
), Struct
, Tuple
(NonNegative
, NonNegative
, NonNegative
, NonNegative
), Struct
)
Extra space between the text of a label and its bounding box (border).
Note
This property is experimental and may change at any point.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
The text value to render.
An alpha value to use to fill text with.
Acceptable values are floating-point numbers between 0 and 1 (0 being transparent and 1 being opaque).
A color to use to fill text with.
Acceptable values are:
any of the named CSS colors, e.g 'green'
, 'indigo'
RGB(A) hex strings, e.g., '#FF0000'
, '#44444444'
CSS4 color strings, e.g., 'rgba(255, 0, 127, 0.6)'
, 'rgb(0 127 0 / 1.0)'
, or 'hsl(60deg 100% 50% / 1.0)'
a 3-tuple of integers (r, g, b) between 0 and 255
a 4-tuple of (r, g, b, a) where r, g, b are integers between 0 and 255, and a is between 0 and 1
a 32-bit unsigned integer using the 0xRRGGBBAA byte order pattern
Name of a font to use for rendering text, e.g., 'times'
, 'helvetica'
.
A style to use for rendering text.
Acceptable values are:
'normal'
normal text
'italic'
italic text
'bold'
bold text
How much additional space should be allocated for the title. The value is provided as a number, but should be treated as a percentage of font size. The default is 100%, which means no additional space will be used.
Alignment of the text in its enclosing space, across the direction of the text.
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: CustomDimensional
Imperial units of length measurement.
{ "basis": { "entries": [ [ "in", [ 0.08333333333333333, "in", "inch" ] ], [ "ft", [ 1, "ft", "foot" ] ], [ "yd", [ 3, "yd", "yard" ] ], [ "ch", [ 66, "ch", "chain" ] ], [ "fur", [ 660, "fur", "furlong" ] ], [ "mi", [ 5280, "mi", "mile" ] ], [ "lea", [ 15840, "lea", "league" ] ] ], "type": "map" }, "exclude": [], "id": "p54558", "include": null, "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "name": null, "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "ticks": [ 1, 3, 6, 12, 60 ] }
The basis defining the units of measurement.
This consists of a mapping between short unit names and their corresponding scaling factors, TeX names and optional long names. For example, the basis for defining angular units of measurement is:
basis = { "°": (1, "^\circ", "degree"), "'": (1/60, "^\prime", "minute"), "''": (1/3600, "^{\prime\prime}", "second"), }
A subset of units from the basis to avoid.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: TextAnnotation
Render a single text label as an annotation.
Label
will render a single text label at given x
and y
coordinates, which can be in either screen (pixel) space, or data (axis range) space.
The label can also be configured with a screen space offset from x
and y
, by using the x_offset
and y_offset
properties.
Additionally, the label can be rotated with the angle
property.
There are also standard text, fill, and line properties to control the appearance of the text, its background, as well as the rectangular bounding box border.
See Labels for information on plotting labels.
{ "anchor": "auto", "angle": 0, "angle_units": "rad", "background_fill_alpha": 1.0, "background_fill_color": null, "background_hatch_alpha": 1.0, "background_hatch_color": "black", "background_hatch_extra": { "type": "map" }, "background_hatch_pattern": null, "background_hatch_scale": 12.0, "background_hatch_weight": 1.0, "border_line_alpha": 1.0, "border_line_cap": "butt", "border_line_color": null, "border_line_dash": [], "border_line_dash_offset": 0, "border_line_join": "bevel", "border_line_width": 1, "border_radius": 0, "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "direction": "anticlock", "editable": false, "elements": [], "group": null, "html_attributes": { "type": "map" }, "html_id": null, "id": "p54566", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "annotation", "name": null, "padding": 0, "propagate_hover": false, "renderers": [], "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "text": "", "text_align": "left", "text_alpha": 1.0, "text_baseline": "bottom", "text_color": "#444444", "text_font": "helvetica", "text_font_size": "16px", "text_font_style": "normal", "text_line_height": 1.2, "text_outline_color": null, "visible": true, "x": { "name": "unset", "type": "symbol" }, "x_offset": 0, "x_range_name": "default", "x_units": "data", "y": { "name": "unset", "type": "symbol" }, "y_offset": 0, "y_range_name": "default", "y_units": "data" }
Either
(Either
(Enum
(Anchor
), Tuple
(Either
(Enum
(Align
), Enum
(HAlign
), Percent
), Either
(Enum
(Align
), Enum
(VAlign
), Percent
))), Auto
)
Position within the bounding box of the text of a label to which x
and y
coordinates are anchored to.
Note
This property is experimental and may change at any point.
The angle to rotate the text, as measured from the horizontal.
Acceptable values for units are "rad"
and "deg"
.
The fill alpha values for the text bounding box.
The fill color values for the text bounding box.
The hatch alpha values for the text bounding box.
The hatch color values for the text bounding box.
The hatch pattern values for the text bounding box.
The hatch scale values for the text bounding box.
The hatch weight values for the text bounding box.
The line alpha values for the text bounding box.
The line dash values for the text bounding box.
The line dash offset values for the text bounding box.
The line width values for the text bounding box.
Either
(NonNegative
, Tuple
(NonNegative
, NonNegative
, NonNegative
, NonNegative
), Struct
)
Allows labelâs box to have rounded corners. For the best results, it should be used in combination with padding
.
Note
This property is experimental and may change at any point.
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
The direction for the angle of the label.
Note
This property is experimental and may change at any point.
Allows to interactively modify the geometry of this label.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Either
(NonNegative
, Tuple
(NonNegative
, NonNegative
), Struct
, Tuple
(NonNegative
, NonNegative
, NonNegative
, NonNegative
), Struct
)
Extra space between the text of a label and its bounding box (border).
Note
This property is experimental and may change at any point.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
TextLike
A text or LaTeX notation to render.
The text alpha values for the text.
The text baseline values for the text.
The text font values for the text.
The text font size values for the text.
The text line height values for the text.
Is the renderer visible.
The x-coordinate in screen coordinates to locate the text anchors.
Offset value to apply to the x-coordinate.
This is useful, for instance, if it is desired to âfloatâ text a fixed distance in screen units from a given data position.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
The unit type for the x attribute. Interpreted as data units by default. This doesnât have any effect if x
is a node.
The y-coordinate in screen coordinates to locate the text anchors.
Offset value to apply to the y-coordinate.
This is useful, for instance, if it is desired to âfloatâ text a fixed distance in screen units from a given data position.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
The unit type for the y attribute. Interpreted as data units by default. This doesnât have any effect if y
is a node.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: DataAnnotation
Render multiple text labels as annotations.
LabelSet
will render multiple text labels at given x
and y
coordinates, which can be in either screen (pixel) space, or data (axis range) space. In this case (as opposed to the single Label
model), x
and y
can also be the name of a column from a ColumnDataSource
, in which case the labels will be âvectorizedâ using coordinate values from the specified columns.
The label can also be configured with a screen space offset from x
and y
, by using the x_offset
and y_offset
properties. These offsets may be vectorized by giving the name of a data source column.
Additionally, the label can be rotated with the angle
property (which may also be a column name.)
There are also standard text, fill, and line properties to control the appearance of the text, its background, as well as the rectangular bounding box border.
The data source is provided by setting the source
property.
{ "angle": { "type": "value", "value": 0 }, "background_fill_alpha": { "type": "value", "value": 1.0 }, "background_fill_color": { "type": "value", "value": null }, "background_hatch_alpha": { "type": "value", "value": 1.0 }, "background_hatch_color": { "type": "value", "value": "black" }, "background_hatch_extra": { "type": "map" }, "background_hatch_pattern": { "type": "value", "value": null }, "background_hatch_scale": { "type": "value", "value": 12.0 }, "background_hatch_weight": { "type": "value", "value": 1.0 }, "border_line_alpha": { "type": "value", "value": 1.0 }, "border_line_cap": { "type": "value", "value": "butt" }, "border_line_color": { "type": "value", "value": null }, "border_line_dash": { "type": "value", "value": [] }, "border_line_dash_offset": { "type": "value", "value": 0 }, "border_line_join": { "type": "value", "value": "bevel" }, "border_line_width": { "type": "value", "value": 1 }, "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "elements": [], "group": null, "html_attributes": { "type": "map" }, "html_id": null, "id": "p54623", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "annotation", "name": null, "propagate_hover": false, "renderers": [], "source": { "attributes": { "data": { "type": "map" }, "selected": { "attributes": { "indices": [], "line_indices": [] }, "id": "p54625", "name": "Selection", "type": "object" }, "selection_policy": { "id": "p54626", "name": "UnionRenderers", "type": "object" } }, "id": "p54624", "name": "ColumnDataSource", "type": "object" }, "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "text": { "field": "text", "type": "field" }, "text_align": { "type": "value", "value": "left" }, "text_alpha": { "type": "value", "value": 1.0 }, "text_baseline": { "type": "value", "value": "bottom" }, "text_color": { "type": "value", "value": "#444444" }, "text_font": { "type": "value", "value": "helvetica" }, "text_font_size": { "type": "value", "value": "16px" }, "text_font_style": { "type": "value", "value": "normal" }, "text_line_height": { "type": "value", "value": 1.2 }, "text_outline_color": { "type": "value", "value": null }, "visible": true, "x": { "field": "x", "type": "field" }, "x_offset": { "type": "value", "value": 0 }, "x_range_name": "default", "x_units": "data", "y": { "field": "y", "type": "field" }, "y_offset": { "type": "value", "value": 0 }, "y_range_name": "default", "y_units": "data" }
The angles to rotate the text, as measured from the horizontal.
Units to use for the associated property: deg, rad, grad or turn
The fill alpha values for the text bounding box.
The fill color values for the text bounding box.
The hatch alpha values for the text bounding box.
The hatch color values for the text bounding box.
HatchPatternSpec
The hatch pattern values for the text bounding box.
The hatch scale values for the text bounding box.
The hatch weight values for the text bounding box.
The line alpha values for the text bounding box.
LineCapSpec
The line cap values for the text bounding box.
The line color values for the text bounding box.
DashPatternSpec
The line dash values for the text bounding box.
IntSpec
The line dash offset values for the text bounding box.
LineJoinSpec
The line join values for the text bounding box.
The line width values for the text bounding box.
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Local data source to use when rendering annotations on the plot.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
NullStringSpec
The text values to render.
TextAlignSpec
The text align values for the text.
The text alpha values for the text.
TextBaselineSpec
The text baseline values for the text.
The text color values for the text.
The text font values for the text.
The text font size values for the text.
FontStyleSpec
The text font style values for the text.
The text line height values for the text.
The text outline color values for the text.
Is the renderer visible.
The x-coordinates to locate the text anchors.
Offset values to apply to the x-coordinates.
This is useful, for instance, if it is desired to âfloatâ text a fixed distance in screen units from a given data position.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
The unit type for the xs
attribute. Interpreted as data units by default.
The y-coordinates to locate the text anchors.
Offset values to apply to the y-coordinates.
This is useful, for instance, if it is desired to âfloatâ text a fixed distance in screen units from a given data position.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
The unit type for the ys
attribute. Interpreted as data units by default.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: Annotation
Render informational legends for a plot.
See Legends for information on plotting legends.
{ "background_fill_alpha": 0.95, "background_fill_color": "#ffffff", "background_hatch_alpha": 1.0, "background_hatch_color": "black", "background_hatch_extra": { "type": "map" }, "background_hatch_pattern": null, "background_hatch_scale": 12.0, "background_hatch_weight": 1.0, "border_line_alpha": 0.5, "border_line_cap": "butt", "border_line_color": "#e5e5e5", "border_line_dash": [], "border_line_dash_offset": 0, "border_line_join": "bevel", "border_line_width": 1, "border_radius": 0, "click_policy": "none", "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "elements": [], "glyph_height": 20, "glyph_width": 20, "group": null, "html_attributes": { "type": "map" }, "html_id": null, "id": "p54838", "inactive_fill_alpha": 0.7, "inactive_fill_color": "white", "inactive_hatch_alpha": 1.0, "inactive_hatch_color": "black", "inactive_hatch_extra": { "type": "map" }, "inactive_hatch_pattern": null, "inactive_hatch_scale": 12.0, "inactive_hatch_weight": 1.0, "item_background_fill_alpha": 0.8, "item_background_fill_color": "#f1f1f1", "item_background_hatch_alpha": 1.0, "item_background_hatch_color": "black", "item_background_hatch_extra": { "type": "map" }, "item_background_hatch_pattern": null, "item_background_hatch_scale": 12.0, "item_background_hatch_weight": 1.0, "item_background_policy": "none", "items": [], "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "label_height": "auto", "label_standoff": 5, "label_text_align": "left", "label_text_alpha": 1.0, "label_text_baseline": "middle", "label_text_color": "#444444", "label_text_font": "helvetica", "label_text_font_size": "13px", "label_text_font_style": "normal", "label_text_line_height": 1.2, "label_text_outline_color": null, "label_width": 20, "level": "annotation", "location": "top_right", "margin": 10, "name": null, "ncols": "auto", "nrows": "auto", "orientation": "vertical", "padding": 10, "propagate_hover": false, "renderers": [], "spacing": 3, "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "title": null, "title_location": "above", "title_standoff": 5, "title_text_align": "left", "title_text_alpha": 1.0, "title_text_baseline": "bottom", "title_text_color": "#444444", "title_text_font": "helvetica", "title_text_font_size": "13px", "title_text_font_style": "italic", "title_text_line_height": 1.2, "title_text_outline_color": null, "visible": true, "x_range_name": "default", "y_range_name": "default" }
The fill alpha for the legend background style.
The fill color for the legend background style.
The hatch alpha for the legend background style.
The hatch color for the legend background style.
The hatch pattern for the legend background style.
The hatch scale for the legend background style.
The hatch weight for the legend background style.
The line alpha for the legend border outline.
The line dash for the legend border outline.
The line dash offset for the legend border outline.
The line width for the legend border outline.
Either
(NonNegative
, Tuple
(NonNegative
, NonNegative
, NonNegative
, NonNegative
), Struct
)
Allows the box to have rounded corners.
Defines what happens when a lengendâs item is clicked.
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
The height (in pixels) that the rendered legend glyph should occupy.
The width (in pixels) that the rendered legend glyph should occupy.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
The fill alpha for the legend item style when inactive. These control an overlay on the item that can be used to obscure it when the corresponding glyph is inactive (e.g. by making it semi-transparent).
The fill color for the legend item style when inactive. These control an overlay on the item that can be used to obscure it when the corresponding glyph is inactive (e.g. by making it semi-transparent).
The hatch alpha for the legend item style when inactive. These control an overlay on the item that can be used to obscure it when the corresponding glyph is inactive (e.g. by making it semi-transparent).
The hatch color for the legend item style when inactive. These control an overlay on the item that can be used to obscure it when the corresponding glyph is inactive (e.g. by making it semi-transparent).
The hatch extra for the legend item style when inactive. These control an overlay on the item that can be used to obscure it when the corresponding glyph is inactive (e.g. by making it semi-transparent).
The hatch pattern for the legend item style when inactive. These control an overlay on the item that can be used to obscure it when the corresponding glyph is inactive (e.g. by making it semi-transparent).
The hatch scale for the legend item style when inactive. These control an overlay on the item that can be used to obscure it when the corresponding glyph is inactive (e.g. by making it semi-transparent).
The hatch weight for the legend item style when inactive. These control an overlay on the item that can be used to obscure it when the corresponding glyph is inactive (e.g. by making it semi-transparent).
The fill alpha for the legend itemsâ background style.
The fill color for the legend itemsâ background style.
The hatch alpha for the legend itemsâ background style.
The hatch color for the legend itemsâ background style.
The hatch pattern for the legend itemsâ background style.
The hatch scale for the legend itemsâ background style.
The hatch weight for the legend itemsâ background style.
Defines which items to style, if item_background_fill
is configured.
A list of LegendItem
instances to be rendered in the legend.
This can be specified explicitly, for instance:
legend = Legend(items=[ LegendItem(label="sin(x)", renderers=[r0, r1]), LegendItem(label="2*sin(x)", renderers=[r2]), LegendItem(label="3*sin(x)", renderers=[r3, r4]) ])
But as a convenience, can also be given more compactly as a list of tuples:
legend = Legend(items=[ ("sin(x)", [r0, r1]), ("2*sin(x)", [r2]), ("3*sin(x)", [r3, r4]) ])
where each tuple is of the form: (label, renderers).
The minimum height (in pixels) of the area that legend labels should occupy.
The distance (in pixels) to separate the label from its associated glyph.
The text alpha for the legend labels.
The text baseline for the legend labels.
The text font for the legend labels.
The text font size for the legend labels.
The text line height for the legend labels.
The text outline color for the legend labels.
The minimum width (in pixels) of the area that legend labels should occupy.
Specifies the level in which to paint this renderer.
The location where the legend should draw itself. Itâs either one of LegendLocation
âs enumerated values, or a (x, y)
tuple indicating an absolute location absolute location in screen coordinates (pixels from the bottom-left corner).
Amount of margin around the legend.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
The number of columns in the legendâs layout. By default itâs either one column if the orientation is vertical or the number of items in the legend otherwise. ncols
takes precedence over nrows
for horizontal orientation.
The number of rows in the legendâs layout. By default itâs either one row if the orientation is horizontal or the number of items in the legend otherwise. nrows
takes precedence over ncols
for vertical orientation.
Whether the legend entries should be placed vertically or horizontally when they are drawn.
Either
(NonNegative
, Tuple
(NonNegative
, NonNegative
), Struct
, Tuple
(NonNegative
, NonNegative
, NonNegative
, NonNegative
), Struct
)
Amount of padding between the contents of the legend and its border.
Only applicable when border is visible.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Amount of spacing (in pixels) between legend entries.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Specifies on which side of the legend the title will be located. Titles on the left or right side will be rotated accordingly.
The distance (in pixels) to separate the title from the legend.
The text alpha values for the title text.
The text baseline values for the title text.
The text font values for the title text.
The text font size values for the title text.
The text font style values for the title text.
The text line height values for the title text.
The text outline color values for the title text.
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Set up a JavaScript handler for legend item clicks.
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Set up a handler for legend item clicks.
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: Model
{ "id": "p54925", "index": null, "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "label": { "type": "value", "value": null }, "name": null, "renderers": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "visible": true }
The column data index to use for drawing the representative items.
If None (the default), then Bokeh will automatically choose an index to use. If the label does not refer to a data column name, this is typically the first data point in the data source. Otherwise, if the label does refer to a column name, the legend will have âgroupbyâ behavior, and will choose and display representative points from every âgroupâ in the column.
If set to a number, Bokeh will use that number as the index in all cases.
NullStringSpec
A label for this legend. Can be a string, or a column of a ColumnDataSource. If label
is a field, then it must be in the renderersâ data_source.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
A list of the glyph renderers to draw in the legend. If label
is a field, then all data_sources of renderers must be the same.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Whether the legend item should be displayed. See Hiding legend items in the user guide.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: Dimensional
Model for defining metric units of measurement.
{ "base_unit": { "name": "unset", "type": "symbol" }, "exclude": [], "full_unit": null, "id": "p54933", "include": null, "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "name": null, "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "ticks": [ 1, 2, 5, 10, 15, 20, 25, 50, 75, 100, 125, 150, 200, 250, 500, 750 ] }
The short name of the base unit, e.g. "m"
for meters or "eV"
for electron volts.
A subset of units from the basis to avoid.
The full name of the base unit, e.g. "meter"
or "electronvolt"
.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Preferred values to choose from in non-exact mode.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: Metric
Metric units of length measurement.
{ "base_unit": "m", "exclude": [ "dm", "hm" ], "full_unit": null, "id": "p54942", "include": null, "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "name": null, "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "ticks": [ 1, 2, 5, 10, 15, 20, 25, 50, 75, 100, 125, 150, 200, 250, 500, 750 ] }
The short name of the base unit, e.g. "m"
for meters or "eV"
for electron volts.
A subset of units from the basis to avoid.
The full name of the base unit, e.g. "meter"
or "electronvolt"
.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Preferred values to choose from in non-exact mode.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: ArrowHead
Render a closed-body arrow head.
{ "fill_alpha": { "type": "value", "value": 1.0 }, "fill_color": { "type": "value", "value": "black" }, "hatch_alpha": { "type": "value", "value": 1.0 }, "hatch_color": { "type": "value", "value": "black" }, "hatch_extra": { "type": "map" }, "hatch_pattern": { "type": "value", "value": null }, "hatch_scale": { "type": "value", "value": 12.0 }, "hatch_weight": { "type": "value", "value": 1.0 }, "id": "p54951", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "line_alpha": { "type": "value", "value": 1.0 }, "line_cap": { "type": "value", "value": "butt" }, "line_color": { "type": "value", "value": "black" }, "line_dash": { "type": "value", "value": [] }, "line_dash_offset": { "type": "value", "value": 0 }, "line_join": { "type": "value", "value": "bevel" }, "line_width": { "type": "value", "value": 1 }, "name": null, "size": { "type": "value", "value": 25 }, "subscribed_events": { "type": "set" }, "syncable": true, "tags": [] }
The fill alpha values for the arrow head interior.
The fill color values for the arrow head interior.
The hatch alpha values for the arrow head interior.
The hatch color values for the arrow head interior.
HatchPatternSpec
The hatch pattern values for the arrow head interior.
The hatch scale values for the arrow head interior.
The hatch weight values for the arrow head interior.
The line alpha values for the arrow head outline.
LineCapSpec
The line cap values for the arrow head outline.
The line color values for the arrow head outline.
DashPatternSpec
The line dash values for the arrow head outline.
IntSpec
The line dash offset values for the arrow head outline.
LineJoinSpec
The line join values for the arrow head outline.
The line width values for the arrow head outline.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
The size, in pixels, of the arrow head.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: ArrowHead
Render an open-body arrow head.
{ "id": "p54971", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "line_alpha": { "type": "value", "value": 1.0 }, "line_cap": { "type": "value", "value": "butt" }, "line_color": { "type": "value", "value": "black" }, "line_dash": { "type": "value", "value": [] }, "line_dash_offset": { "type": "value", "value": 0 }, "line_join": { "type": "value", "value": "bevel" }, "line_width": { "type": "value", "value": 1 }, "name": null, "size": { "type": "value", "value": 25 }, "subscribed_events": { "type": "set" }, "syncable": true, "tags": [] }
The line alpha values for the arrow head outline.
LineCapSpec
The line cap values for the arrow head outline.
The line color values for the arrow head outline.
DashPatternSpec
The line dash values for the arrow head outline.
IntSpec
The line dash offset values for the arrow head outline.
LineJoinSpec
The line join values for the arrow head outline.
The line width values for the arrow head outline.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
The size, in pixels, of the arrow head.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: Annotation
Render a shaded polygonal region as an annotation.
See Polygon annotations for information on plotting polygon annotations.
{ "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "editable": false, "elements": [], "fill_alpha": 0.4, "fill_color": "#fff9ba", "group": null, "hatch_alpha": 1.0, "hatch_color": "black", "hatch_extra": { "type": "map" }, "hatch_pattern": null, "hatch_scale": 12.0, "hatch_weight": 1.0, "hover_fill_alpha": 0.4, "hover_fill_color": null, "hover_hatch_alpha": 1.0, "hover_hatch_color": "black", "hover_hatch_extra": { "type": "map" }, "hover_hatch_pattern": null, "hover_hatch_scale": 12.0, "hover_hatch_weight": 1.0, "hover_line_alpha": 0.3, "hover_line_cap": "butt", "hover_line_color": null, "hover_line_dash": [], "hover_line_dash_offset": 0, "hover_line_join": "bevel", "hover_line_width": 1, "html_attributes": { "type": "map" }, "html_id": null, "id": "p54983", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "annotation", "line_alpha": 0.3, "line_cap": "butt", "line_color": "#cccccc", "line_dash": [], "line_dash_offset": 0, "line_join": "bevel", "line_width": 1, "name": null, "propagate_hover": false, "renderers": [], "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "visible": true, "x_range_name": "default", "xs": [], "xs_units": "data", "y_range_name": "default", "ys": [], "ys_units": "data" }
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
Allows to interactively modify the geometry of this polygon.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
The fill alpha values for the polygon.
Note
This property is experimental and may change at any point.
The hatch alpha values for the polygon.
The hatch scale values for the polygon.
The hatch weight values for the polygon.
The fill alpha values for the polygon when hovering over.
The fill color values for the polygon when hovering over.
The hatch alpha values for the polygon when hovering over.
The hatch color values for the polygon when hovering over.
The hatch pattern values for the polygon when hovering over.
The hatch scale values for the polygon when hovering over.
The hatch weight values for the polygon when hovering over.
The line alpha values for the polygon when hovering over.
The line cap values for the polygon when hovering over.
The line color values for the polygon when hovering over.
The line dash values for the polygon when hovering over.
The line dash offset values for the polygon when hovering over.
The line join values for the polygon when hovering over.
The line width values for the polygon when hovering over.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
The line alpha values for the polygon.
The line dash values for the polygon.
The line dash offset values for the polygon.
The line width values for the polygon.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
The unit type for the xs
attribute. Interpreted as data units by default.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
The unit type for the ys
attribute. Interpreted as data units by default.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: Metric
Model for defining reciprocal metric units of measurement, e.g. m^{-1}
.
{ "base_unit": { "name": "unset", "type": "symbol" }, "exclude": [], "full_unit": null, "id": "p55037", "include": null, "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "name": null, "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "ticks": [ 1, 2, 5, 10, 15, 20, 25, 50, 75, 100, 125, 150, 200, 250, 500, 750 ] }
The short name of the base unit, e.g. "m"
for meters or "eV"
for electron volts.
A subset of units from the basis to avoid.
The full name of the base unit, e.g. "meter"
or "electronvolt"
.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Preferred values to choose from in non-exact mode.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: ReciprocalMetric
Metric units of reciprocal length measurement.
{ "base_unit": "m", "exclude": [ "dm", "hm" ], "full_unit": null, "id": "p55046", "include": null, "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "name": null, "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "ticks": [ 1, 2, 5, 10, 15, 20, 25, 50, 75, 100, 125, 150, 200, 250, 500, 750 ] }
The short name of the base unit, e.g. "m"
for meters or "eV"
for electron volts.
A subset of units from the basis to avoid.
The full name of the base unit, e.g. "meter"
or "electronvolt"
.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Preferred values to choose from in non-exact mode.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: Annotation
Represents a scale bar annotation.
{ "anchor": "auto", "background_fill_alpha": 0.95, "background_fill_color": "#ffffff", "background_hatch_alpha": 1.0, "background_hatch_color": "black", "background_hatch_extra": { "type": "map" }, "background_hatch_pattern": null, "background_hatch_scale": 12.0, "background_hatch_weight": 1.0, "bar_length": 0.2, "bar_length_units": "screen", "bar_line_alpha": 1.0, "bar_line_cap": "butt", "bar_line_color": "black", "bar_line_dash": [], "bar_line_dash_offset": 0, "bar_line_join": "bevel", "bar_line_width": 2, "border_line_alpha": 0.5, "border_line_cap": "butt", "border_line_color": "#e5e5e5", "border_line_dash": [], "border_line_dash_offset": 0, "border_line_join": "bevel", "border_line_width": 1, "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "dimensional": { "attributes": { "include": null }, "id": "p55056", "name": "MetricLength", "type": "object" }, "elements": [], "group": null, "html_attributes": { "type": "map" }, "html_id": null, "id": "p55055", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "label": "@{value} @{unit}", "label_align": "center", "label_location": "below", "label_standoff": 5, "label_text_align": "left", "label_text_alpha": 1.0, "label_text_baseline": "middle", "label_text_color": "#444444", "label_text_font": "helvetica", "label_text_font_size": "13px", "label_text_font_style": "normal", "label_text_line_height": 1.2, "label_text_outline_color": null, "length_sizing": "adaptive", "level": "annotation", "location": "top_right", "margin": 10, "name": null, "orientation": "horizontal", "padding": 10, "propagate_hover": false, "range": "auto", "renderers": [], "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "ticker": { "attributes": { "minor_ticks": [], "ticks": [] }, "id": "p55057", "name": "FixedTicker", "type": "object" }, "title": "", "title_align": "center", "title_location": "above", "title_standoff": 5, "title_text_align": "left", "title_text_alpha": 1.0, "title_text_baseline": "bottom", "title_text_color": "#444444", "title_text_font": "helvetica", "title_text_font_size": "13px", "title_text_font_style": "italic", "title_text_line_height": 1.2, "title_text_outline_color": null, "unit": "m", "visible": true, "x_range_name": "default", "x_units": "data", "y_range_name": "default", "y_units": "data" }
Either
(Auto
, Enum
(Anchor
), Tuple
(Either
(Auto
, Either
(Enum
(Align
), Enum
(HAlign
), Percent
)), Either
(Auto
, Either
(Enum
(Align
), Enum
(VAlign
), Percent
))))
The origin for scale bar positioning.
If "auto"
in any or both dimensions, then the anchor in these dimensions will be determined based on the position, so that the scale bar looks good.
The fill alpha for the scale bar background fill style.
The fill color for the scale bar background fill style.
The hatch alpha for the scale bar background hatch style.
The hatch color for the scale bar background hatch style.
The hatch pattern for the scale bar background hatch style.
The hatch scale for the scale bar background hatch style.
The hatch weight for the scale bar background hatch style.
The length of the bar.
This is either a fraction of the frame, a number of pixels or distance in the data space, depending on the configuration of bar_length_units
.
Enum
(Enumeration(screen, data, percent))
Defines how to interpret bar_length
.
Supported values are:
"screen"
- the length is provided in pixels or as a percentage of the parent container (e.g. the frame) if the value provided is in [0, 1]
range
"data"
- the length is provided in data space units
"percent"
- the length is a percentage of the parent container (e.g. the frame)
Note
"data"
units assume a linear scale or a linear like scale (e.g. categorical scale) is used. Otherwise the length of the bar would be position dependent.
The line alpha values for the bar line style.
The line dash values for the bar line style.
The line dash offset values for the bar line style.
The line width values for the bar line style.
The line alpha for the scale bar border line style.
The line color for the scale bar border line style.
The line dash for the scale bar border line style.
The line dash offset for the scale bar border line style.
The line width for the scale bar border line style.
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
Instance
(Dimensional
)
Defines the units of measurement.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
The label template.
This can use special variables:
@{value}
The current value. Optionally can provide a number formatter with e.g. @{value}{%.2f}
.
@{unit}
The unit of measurement.
Specifies where to align scale barâs label along the bar.
This property effective when placing the label above or below a horizontal scale bar, or left or right of a vertical one.
Specifies on which side of the scale bar the label will be located.
The distance (in pixels) to separate the label from the scale bar.
The text alpha values for the label text style.
The text baseline values for the label text style.
The text font values for the label text style.
The text font size values for the label text style.
The text font style values for the label text style.
The text line height values for the label text style.
The text outline color values for the label text style.
Enum
(Enumeration(adaptive, exact))
Defines how the length of the bar is interpreted.
This can either be:
"adaptive"
- the computed length is fit into a set of ticks provided be the dimensional model. If no ticks are provided, then the behavior is the same as if "exact"
sizing was used
"exact"
- the computed length is used as-is
Specifies the level in which to paint this renderer.
Either
(Enum
(Anchor
), Tuple
(Either
(Enum
(HAlign
), Float
, Either
(Float
, Datetime
, Factor
)), Either
(Enum
(VAlign
), Float
, Either
(Float
, Datetime
, Factor
))))
Position of the scale bar within the parent container (usually cartesian frame).
Amount of margin (in pixels) around the outside of the scale bar.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Whether the scale bar should be oriented horizontally or vertically.
Amount of padding (in pixels) between the contents of the scale bar and its border.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
The range for which to display the scale.
This can be either a range reference or "auto"
, in which case the scale bar will pick the default x or y range of the frame, depending on the orientation of the scale bar.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
A ticker to use for computing locations of axis components.
Note that if using the default fixed ticker with no predefined ticks, then the appearance of the scale bar will be just a solid bar with no additional markings.
The title text to render.
Specifies where to align scale barâs title along the bar.
This property effective when placing the title above or below a horizontal scale bar, or left or right of a vertical one.
Specifies on which side of the legend the title will be located.
The distance (in pixels) to separate the title from the scale bar.
The text alpha values for the title text style.
The text baseline values for the title text style.
The text font values for the title text style.
The text font size values for the title text style.
The text font style values for the title text style.
The text line height values for the title text style.
The text outline color values for the title text style.
The unit of the range
property.
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
Enum
(Enumeration(data, screen, view, percent))
The interpretation of x coordinate values provided in position
property.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
Enum
(Enumeration(data, screen, view, percent))
The interpretation of y coordinate values provided in position
property.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: Annotation
Render a sloped line as an annotation.
See Slopes for information on plotting slopes.
{ "above_fill_alpha": 0.4, "above_fill_color": null, "above_hatch_alpha": 1.0, "above_hatch_color": "black", "above_hatch_extra": { "type": "map" }, "above_hatch_pattern": null, "above_hatch_scale": 12.0, "above_hatch_weight": 1.0, "below_fill_alpha": 0.4, "below_fill_color": null, "below_hatch_alpha": 1.0, "below_hatch_color": "black", "below_hatch_extra": { "type": "map" }, "below_hatch_pattern": null, "below_hatch_scale": 12.0, "below_hatch_weight": 1.0, "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "elements": [], "gradient": null, "group": null, "html_attributes": { "type": "map" }, "html_id": null, "id": "p55300", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "annotation", "line_alpha": 1.0, "line_cap": "butt", "line_color": "black", "line_dash": [], "line_dash_offset": 0, "line_join": "bevel", "line_width": 1, "name": null, "propagate_hover": false, "renderers": [], "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "visible": true, "x_range_name": "default", "y_intercept": null, "y_range_name": "default" }
The fill alpha values for the area above the line.
The hatch alpha values for the area above the line.
The hatch color values for the area above the line.
The hatch pattern values for the area above the line.
The hatch scale values for the area above the line.
The hatch weight values for the area above the line.
The fill alpha values for the area below the line.
The hatch alpha values for the area below the line.
The hatch color values for the area below the line.
The hatch pattern values for the area below the line.
The hatch scale values for the area below the line.
The hatch weight values for the area below the line.
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
The gradient of the line, in data units
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
The line alpha values for the line.
The line dash values for the line.
The line dash offset values for the line.
The line width values for the line.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
The y intercept of the line, in data units
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: Annotation
Render a horizontal or vertical line span.
See Spans for information on plotting spans.
{ "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "dimension": "width", "editable": false, "elements": [], "group": null, "hover_line_alpha": 0.3, "hover_line_cap": "butt", "hover_line_color": null, "hover_line_dash": [], "hover_line_dash_offset": 0, "hover_line_join": "bevel", "hover_line_width": 1, "html_attributes": { "type": "map" }, "html_id": null, "id": "p55344", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "annotation", "line_alpha": 1.0, "line_cap": "butt", "line_color": "black", "line_dash": [], "line_dash_offset": 0, "line_join": "bevel", "line_width": 1, "location": null, "location_units": "data", "name": null, "propagate_hover": false, "renderers": [], "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "visible": true, "x_range_name": "default", "y_range_name": "default" }
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
The direction of the span can be specified by setting this property to âheightâ (y
direction) or âwidthâ (x
direction).
Allows to interactively modify the geometry of this span.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
Note
This property is experimental and may change at any point.
The line alpha values for the span when hovering over.
The line color values for the span when hovering over.
The line dash values for the span when hovering over.
The line dash offset values for the span when hovering over.
The line join values for the span when hovering over.
The line width values for the span when hovering over.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
The line alpha values for the span.
The line dash values for the span.
The line dash offset values for the span.
The line width values for the span.
The location of the span, along dimension
.
The unit type for the location attribute. Interpreted as âdata spaceâ units by default.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: ArrowHead
Render a tee-style arrow head.
{ "id": "p55381", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "line_alpha": { "type": "value", "value": 1.0 }, "line_cap": { "type": "value", "value": "butt" }, "line_color": { "type": "value", "value": "black" }, "line_dash": { "type": "value", "value": [] }, "line_dash_offset": { "type": "value", "value": 0 }, "line_join": { "type": "value", "value": "bevel" }, "line_width": { "type": "value", "value": 1 }, "name": null, "size": { "type": "value", "value": 25 }, "subscribed_events": { "type": "set" }, "syncable": true, "tags": [] }
The line alpha values for the arrow head outline.
LineCapSpec
The line cap values for the arrow head outline.
The line color values for the arrow head outline.
DashPatternSpec
The line dash values for the arrow head outline.
IntSpec
The line dash offset values for the arrow head outline.
LineJoinSpec
The line join values for the arrow head outline.
The line width values for the arrow head outline.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
The size, in pixels, of the arrow head.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: Annotation
Base class for text annotation models such as labels and titles.
Note
This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.
{ "background_fill_alpha": 1.0, "background_fill_color": null, "background_hatch_alpha": 1.0, "background_hatch_color": "black", "background_hatch_extra": { "type": "map" }, "background_hatch_pattern": null, "background_hatch_scale": 12.0, "background_hatch_weight": 1.0, "border_line_alpha": 1.0, "border_line_cap": "butt", "border_line_color": null, "border_line_dash": [], "border_line_dash_offset": 0, "border_line_join": "bevel", "border_line_width": 1, "border_radius": 0, "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "elements": [], "group": null, "html_attributes": { "type": "map" }, "html_id": null, "id": "p55393", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "annotation", "name": null, "padding": 0, "propagate_hover": false, "renderers": [], "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "text": "", "text_align": "left", "text_alpha": 1.0, "text_baseline": "bottom", "text_color": "#444444", "text_font": "helvetica", "text_font_size": "16px", "text_font_style": "normal", "text_line_height": 1.2, "text_outline_color": null, "visible": true, "x_range_name": "default", "y_range_name": "default" }
The fill alpha values for the text bounding box.
The fill color values for the text bounding box.
The hatch alpha values for the text bounding box.
The hatch color values for the text bounding box.
The hatch pattern values for the text bounding box.
The hatch scale values for the text bounding box.
The hatch weight values for the text bounding box.
The line alpha values for the text bounding box.
The line dash values for the text bounding box.
The line dash offset values for the text bounding box.
The line width values for the text bounding box.
Either
(NonNegative
, Tuple
(NonNegative
, NonNegative
, NonNegative
, NonNegative
), Struct
)
Allows labelâs box to have rounded corners. For the best results, it should be used in combination with padding
.
Note
This property is experimental and may change at any point.
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Either
(NonNegative
, Tuple
(NonNegative
, NonNegative
), Struct
, Tuple
(NonNegative
, NonNegative
, NonNegative
, NonNegative
), Struct
)
Extra space between the text of a label and its bounding box (border).
Note
This property is experimental and may change at any point.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
TextLike
A text or LaTeX notation to render.
The text alpha values for the text.
The text baseline values for the text.
The text font values for the text.
The text font size values for the text.
The text line height values for the text.
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: TextAnnotation
Render a single title box as an annotation.
See Titles for information on plotting titles.
{ "align": "left", "background_fill_alpha": 1.0, "background_fill_color": null, "background_hatch_alpha": 1.0, "background_hatch_color": "black", "background_hatch_extra": { "type": "map" }, "background_hatch_pattern": null, "background_hatch_scale": 12.0, "background_hatch_weight": 1.0, "border_line_alpha": 1.0, "border_line_cap": "butt", "border_line_color": null, "border_line_dash": [], "border_line_dash_offset": 0, "border_line_join": "bevel", "border_line_width": 1, "border_radius": 0, "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "elements": [], "group": null, "html_attributes": { "type": "map" }, "html_id": null, "id": "p55439", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "annotation", "name": null, "offset": 0, "padding": 0, "propagate_hover": false, "renderers": [], "standoff": 10, "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "text": "", "text_align": "left", "text_alpha": 1.0, "text_baseline": "bottom", "text_color": "#444444", "text_font": "helvetica", "text_font_size": "13px", "text_font_style": "bold", "text_line_height": 1.0, "text_outline_color": null, "vertical_align": "bottom", "visible": true, "x_range_name": "default", "y_range_name": "default" }
Alignment of the text in its enclosing space, along the direction of the text.
The fill alpha values for the text bounding box.
The fill color values for the text bounding box.
The hatch alpha values for the text bounding box.
The hatch color values for the text bounding box.
The hatch pattern values for the text bounding box.
The hatch scale values for the text bounding box.
The hatch weight values for the text bounding box.
The line alpha values for the text bounding box.
The line dash values for the text bounding box.
The line dash offset values for the text bounding box.
The line width values for the text bounding box.
Either
(NonNegative
, Tuple
(NonNegative
, NonNegative
, NonNegative
, NonNegative
), Struct
)
Allows labelâs box to have rounded corners. For the best results, it should be used in combination with padding
.
Note
This property is experimental and may change at any point.
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Offset the text by a number of pixels (can be positive or negative). Shifts the text in different directions based on the location of the title:
above: shifts title right
right: shifts title down
below: shifts title right
left: shifts title up
Either
(NonNegative
, Tuple
(NonNegative
, NonNegative
), Struct
, Tuple
(NonNegative
, NonNegative
, NonNegative
, NonNegative
), Struct
)
Extra space between the text of a label and its bounding box (border).
Note
This property is experimental and may change at any point.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
TextLike
A text or LaTeX notation to render.
The text alpha values for the text.
The text baseline values for the text.
The text font values for the text.
The text font size values for the text.
The text line height values for the text.
Alignment of the text in its enclosing space, across the direction of the text.
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: HTMLAnnotation
{ "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "elements": [], "group": null, "html_attributes": { "type": "map" }, "html_id": null, "id": "p55489", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "annotation", "name": null, "propagate_hover": false, "renderers": [], "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "toolbar": { "name": "unset", "type": "symbol" }, "visible": true, "x_range_name": "default", "y_range_name": "default" }
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: ArrowHead
Render a vee-style arrow head.
{ "fill_alpha": { "type": "value", "value": 1.0 }, "fill_color": { "type": "value", "value": "black" }, "hatch_alpha": { "type": "value", "value": 1.0 }, "hatch_color": { "type": "value", "value": "black" }, "hatch_extra": { "type": "map" }, "hatch_pattern": { "type": "value", "value": null }, "hatch_scale": { "type": "value", "value": 12.0 }, "hatch_weight": { "type": "value", "value": 1.0 }, "id": "p55509", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "line_alpha": { "type": "value", "value": 1.0 }, "line_cap": { "type": "value", "value": "butt" }, "line_color": { "type": "value", "value": "black" }, "line_dash": { "type": "value", "value": [] }, "line_dash_offset": { "type": "value", "value": 0 }, "line_join": { "type": "value", "value": "bevel" }, "line_width": { "type": "value", "value": 1 }, "name": null, "size": { "type": "value", "value": 25 }, "subscribed_events": { "type": "set" }, "syncable": true, "tags": [] }
The fill alpha values for the arrow head interior.
The fill color values for the arrow head interior.
The hatch alpha values for the arrow head interior.
The hatch color values for the arrow head interior.
HatchPatternSpec
The hatch pattern values for the arrow head interior.
The hatch scale values for the arrow head interior.
The hatch weight values for the arrow head interior.
The line alpha values for the arrow head outline.
LineCapSpec
The line cap values for the arrow head outline.
The line color values for the arrow head outline.
DashPatternSpec
The line dash values for the arrow head outline.
IntSpec
The line dash offset values for the arrow head outline.
LineJoinSpec
The line join values for the arrow head outline.
The line width values for the arrow head outline.
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
The size, in pixels, of the arrow head.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
Bases: DataAnnotation
Render a whisker along a dimension.
See Whiskers for information on plotting whiskers.
{ "base": { "field": "base", "type": "field" }, "context_menu": null, "coordinates": null, "css_classes": [], "css_variables": { "type": "map" }, "dimension": "height", "elements": [], "group": null, "html_attributes": { "type": "map" }, "html_id": null, "id": "p55529", "js_event_callbacks": { "type": "map" }, "js_property_callbacks": { "type": "map" }, "level": "underlay", "line_alpha": { "type": "value", "value": 1.0 }, "line_cap": { "type": "value", "value": "butt" }, "line_color": { "type": "value", "value": "black" }, "line_dash": { "type": "value", "value": [] }, "line_dash_offset": { "type": "value", "value": 0 }, "line_join": { "type": "value", "value": "bevel" }, "line_width": { "type": "value", "value": 1 }, "lower": { "field": "lower", "type": "field" }, "lower_head": { "attributes": { "size": { "type": "value", "value": 10 } }, "id": "p55533", "name": "TeeHead", "type": "object" }, "name": null, "propagate_hover": false, "renderers": [], "source": { "attributes": { "data": { "type": "map" }, "selected": { "attributes": { "indices": [], "line_indices": [] }, "id": "p55531", "name": "Selection", "type": "object" }, "selection_policy": { "id": "p55532", "name": "UnionRenderers", "type": "object" } }, "id": "p55530", "name": "ColumnDataSource", "type": "object" }, "styles": { "type": "map" }, "stylesheets": [], "subscribed_events": { "type": "set" }, "syncable": true, "tags": [], "upper": { "field": "upper", "type": "field" }, "upper_head": { "attributes": { "size": { "type": "value", "value": 10 } }, "id": "p55534", "name": "TeeHead", "type": "object" }, "visible": true, "x_range_name": "default", "y_range_name": "default" }
The orthogonal coordinates of the upper and lower values.
Units to use for the associated property: canvas, screen or data
A menu to display when user right clicks on the component.
Note
Use shift key when right clicking to display the native context menu.
A list of additional CSS classes to add to the underlying DOM element.
Allows to define dynamically computed CSS variables.
This can be used, for example, to coordinate positioning and styling between canvasâ renderers and/or visuals and HTML-based UI elements.
Variables defined here are equivalent to setting the same variables under :host { ... }
in a CSS stylesheet.
Note
This property is experimental and may change at any point.
The direction of the whisker can be specified by setting this property to âheightâ (y
direction) or âwidthâ (x
direction).
A collection of DOM-based UI elements attached to this renderer.
This can include floating elements like tooltips, allowing to establish a parent-child relationship between this renderer and its UI elements.
Note
This property is an equivalent of Pane.elements
in DOM-based UIs.
Note
This property is experimental and may change at any point.
Allows to configure HTML attributes on the underlying HTML element.
Sets the id
attribute of the underlying HTML element.
This is a shorthand for the common HTML id
attribute. Alternatively the id
can be set in the html_attributes
dictionary. html_id
takes precedence.
Specifies the level in which to paint this renderer.
The line alpha values for the whisker body.
LineCapSpec
The line cap values for the whisker body.
The line color values for the whisker body.
DashPatternSpec
The line dash values for the whisker body.
IntSpec
The line dash offset values for the whisker body.
LineJoinSpec
The line join values for the whisker body.
The line width values for the whisker body.
The coordinates of the lower end of the whiskers.
Units to use for the associated property: canvas, screen or data
An arbitrary, user-supplied name for this model.
This name can be useful when querying the document to retrieve specific Bokeh models.
>>> plot.scatter([1,2,3], [4,5,6], name="temp") >>> plot.select(name="temp") [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]
Note
No uniqueness guarantees or other conditions are enforced on any names that are provided, nor is the name used directly by Bokeh for any reason.
Allows to propagate hover events to the parent renderer, frame or canvas.
Note
This property is experimental and may change at any point.
A collection of renderers attached to this renderer.
Note
This property is experimental and may change at any point.
Local data source to use when rendering annotations on the plot.
Inline CSS styles applied to the underlying DOM element.
Additional style-sheets to use for the underlying DOM element.
Note that all bokehâs components use shadow DOM, thus any included style sheets must reflect that, e.g. use :host
CSS pseudo selector to access the root DOM element.
Indicates whether this model should be synchronized back to a Bokeh server when updated in a web browser. Setting to False
may be useful to reduce network traffic when dealing with frequently updated objects whose updated values we donât need.
Note
Setting this property to False
will prevent any on_change()
callbacks on this object from triggering. However, any JS-side callbacks will still work.
An optional list of arbitrary, user-supplied values to attach to this model.
This data can be useful when querying the document to retrieve specific Bokeh models:
>>> r = plot.scatter([1,2,3], [4,5,6]) >>> r.tags = ["foo", 10] >>> plot.select(tags=['foo', 10]) [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]
Or simply a convenient way to attach any necessary metadata to a model that can be accessed by CustomJS
callbacks, etc.
Note
No uniqueness guarantees or other conditions are enforced on any tags that are provided, nor are the tags used directly by Bokeh for any reason.
The coordinates of the upper end of the whiskers.
Units to use for the associated property: canvas, screen or data
Is the renderer visible.
A particular (named) x-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default x-range.
A particular (named) y-range to use for computing screen locations when rendering glyphs on the plot. If unset, use the default y-range.
Apply a set of theme values which will be used rather than defaults, but will not override application-set values.
The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the HasProps
instance should modify it).
property_values (dict) â theme values to use in place of defaults
None
Clear any currently defined custom extensions.
Serialization calls will result in any currently defined custom extensions being included with the generated Document, whether or not there are utilized. This method can be used to clear out all existing custom extension definitions.
Duplicate a HasProps
object.
This creates a shallow clone of the original model, i.e. any mutable containers or child models will not be duplicated. Allows to override particular properties while cloning.
Collect the names of all DataSpec
properties on this class.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
List of property descriptors in the order of definition.
Clean up references to the document and property
Structural equality of models.
other (HasProps) â the other instance to compare to
True, if properties are structurally equal, otherwise False
Link two Bokeh model properties using JavaScript.
This is a convenience method that simplifies adding a CustomJS
callback to update one Bokeh model property whenever another changes value.
Added in version 1.1
ValueError â
Examples
This code with js_link
:
select.js_link('value', plot, 'sizing_mode')
is equivalent to the following:
from bokeh.models import CustomJS select.js_on_change('value', CustomJS(args=dict(other=plot), code="other.sizing_mode = this.value" ) )
Additionally, to use attr_selector to attach the left side of a range slider to a plotâs x_range:
range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)
which is equivalent to:
from bokeh.models import CustomJS range_slider.js_on_change('value', CustomJS(args=dict(other=plot.x_range), code="other.start = this.value[0]" ) )
Attach a CustomJS
callback to an arbitrary BokehJS model event.
On the BokehJS side, change events for model properties have the form "change:property_name"
. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be prefixed with "change:"
automatically:
# these two are equivalent source.js_on_change('data', callback) source.js_on_change('change:data', callback)
However, there are other kinds of events that can be useful to respond to, in addition to property change events. For example to run a callback whenever data is streamed to a ColumnDataSource
, use the "stream"
event on the source:
source.js_on_change('streaming', callback)
Find the PropertyDescriptor
for a Bokeh property on a class, given the property name.
descriptor for property named name
Add a callback on this object to trigger when attr
changes.
attr (str) â an attribute name on this object
*callbacks (callable) â callback functions to register
None
Examples
widget.on_change('value', callback1, callback2, ..., callback_n)
Run callbacks when the specified event occurs on this Model
Not all Events are supported for all Models. See specific Events in bokeh.events for more information on which Models are able to trigger them.
Generate Python Parameter
values suitable for functions that are derived from the glyph.
list(Parameter)
Collect the names of properties on this class.
Warning
In a future version of Bokeh, this method will return a dictionary mapping property names to property objects. To future-proof this current usage of this method, wrap the return value in list
.
property names
Collect the names of all properties on this class that also have references.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Collect a dict mapping property names to their values.
This method always traverses the class hierarchy and includes properties defined on any parent classes.
Non-serializable properties are skipped and property values are in âserializedâ format which may be slightly different from the values you would normally read from the properties; the intent of this method is to return the information needed to losslessly reconstitute the object instance.
Query the properties values of HasProps
instances with a predicate.
query (callable) â A callable that accepts property descriptors and returns True or False
include_defaults (bool, optional) â Whether to include properties that have not been explicitly set by a user (default: True)
mapping of property names and values for matching properties
Returns all Models
that this object has references to.
Remove a callback from this object
Query this object and all of its references for objects that match the given selector.
selector (JSON-like)
seq[Model]
Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector: :type selector: JSON-like
Model
Set a property value on this object from JSON.
name (str) â name of the attribute to set
value (JSON-value) â value to set to the attribute to
setter (ClientSession or ServerSession or None, optional) â
This is used to prevent âboomerangâ updates to Bokeh apps.
In the context of a Bokeh server application, incoming updates to properties will be annotated with the session that is doing the updating. This value is propagated through any subsequent change notifications that the update triggers. The session can compare the event setter to itself, and suppress any updates that originate from itself.
None
Update objects that match a given selector with the specified attribute/value updates.
selector (JSON-like)
updates (dict)
None
Get any theme-provided overrides.
Results are returned as a dict from property name to value, or None
if no theme overrides any values for this instance.
dict or None
Converts this object to a serializable representation.
Remove any themed values and restore defaults.
None
Updates the objectâs properties from the given keyword arguments.
None
Examples
The following are equivalent:
from bokeh.models import Range1d r = Range1d # set properties individually: r.start = 10 r.end = 20 # update properties together: r.update(start=10, end=20)
The Document
this model is attached to (can be None
)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4