bokeh.core.enums¶
Common enumerations to be used together with Enum
property.
This module provides many pre-defined enumerations, as well as functions for creating new enumerations.
New enumerations can be created using the enumeration()
function:
#: Specify a nautically named side, port or starboard
MyEnum = enumeration("port", "starboard")
Typically, enumerations are used to define Enum
properties:
from bokeh.model import Model
from bokeh.core.properties import Enum
class MyModel(Model):
location = Enum(MyEnum, help="""
Whether the thing should be a port or starboard.
""")
Enumerations have a defined order and support iteration:
>>> for loc in MyEnum:
... print(loc)
...
port
starboard
as well as containment tests:
>>> "port" in MyEnum
True
Enumerations can be easily documented in Sphinx documentation with the bokeh_enum Sphinx extension.
-
enumeration
(*values, **kwargs)[source]¶ Create an
enumeration()
object from a sequence of values.Call
enumeration
with a sequence of (unique) strings to create an Enumeration object:#: Specify the horizontal alignment for rendering text TextAlign = enumeration("left", "right", "center")
Parameters: values (str) – string enumeration values, passed as positional arguments
The order of arguments is the order of the enumeration, and the first element will be considered the default value when used to create
Enum
properties.Keyword Arguments: case_sensitive (bool, optional) – Whether validation should consider case or not (default: True) Raises: ValueError if values empty, if any value is not a string or not unique Returns: Enumeration
-
Aggregation
= Enumeration(sum, mean, count, nunique, median, min, max)¶ Specify an aggregation type for different charts
-
Anchor
= Enumeration(top_left, top_center, top_right, center_left, center, center_right, bottom_left, bottom_center, bottom_right)¶ Specify a fixed location for a Bokeh legend
-
AngleUnits
= Enumeration(deg, rad)¶ Specify the units for an angle value
-
ButtonType
= Enumeration(default, primary, success, warning, danger, link)¶ Specify a style for button widgets
-
DashPattern
= Enumeration(solid, dashed, dotted, dotdash, dashdot)¶ Specify a named dashing patter for stroking lines
-
DateFormat
= Enumeration(ATOM, W3C, RFC-3339, ISO-8601, COOKIE, RFC-822, RFC-850, RFC-1036, RFC-1123, RFC-2822, RSS, TICKS, TIMESTAMP)¶ Specify a format for printing dates
-
DatetimeUnits
= Enumeration(microseconds, milliseconds, seconds, minsec, minutes, hourmin, hours, days, months, years)¶ Specify a date/time scale
-
DeprecatedAnchor
= Enumeration(left_center, right_center)¶ Deprecated legend location/anchor
-
DeprecatedLegendLocation
= Enumeration(left_center, right_center)¶ Deprecated legend location/anchor
-
Dimension
= Enumeration(width, height)¶ Specify a vertical/horizontal dimension
-
Dimensions
= Enumeration(width, height, both)¶ Specify a vertical/horizontal dimensions
-
Direction
= Enumeration(clock, anticlock)¶ Specify a stroke direction for circles, wedges, etc.
-
FontStyle
= Enumeration(normal, italic, bold)¶ Specify the font style for rendering text
-
HorizontalLocation
= Enumeration(left, right)¶ Specify a horizontal location in plot layouts
-
JitterRandomDistribution
= Enumeration(uniform, normal)¶ Specify a distribution to use for the Jitter class
-
LegendLocation
= Enumeration(top_left, top_center, top_right, center_left, center, center_right, bottom_left, bottom_center, bottom_right)¶ Specify a fixed location for a Bokeh legend
-
LineCap
= Enumeration(butt, round, square)¶ Specify how stroked lines should be terminated
-
LineDash
= Enumeration(solid, dashed, dotted, dotdash, dashdot)¶ Specify a named dash pattern for stroking lines
-
LineJoin
= Enumeration(miter, round, bevel)¶ Specify how stroked lines should be joined together
-
Location
= Enumeration(above, below, left, right)¶ Specify a location in plot layouts
-
MapType
= Enumeration(satellite, roadmap, terrain, hybrid)¶ Specify a style for a Google map
-
NamedColor
= Enumeration(aliceblue, antiquewhite, aqu .... white, whitesmoke, yellow, yellowgreen)¶ Specify one of the 137 named CSS colors
-
NumeralLanguage
= Enumeration(be-nl, chs, cs, da-dk, de-ch, de, en, en-gb, es-ES, es, et, fi, fr-CA, fr-ch, fr, hu, it, ja, nl-nl, pl, pt-br, pt-pt, ru, ru-UA, sk, th, tr, uk-UA)¶ Specify a locale for printing numeric values
-
Orientation
= Enumeration(horizontal, vertical)¶ Specify a vertical/horizontal orientation for something
-
Palette
= Enumeration(Accent3, Accent4, Accent5, A .... Rd5, YlOrRd6, YlOrRd7, YlOrRd8, YlOrRd9)¶ Specify the name of a palette from bokeh.palettes
-
RenderLevel
= Enumeration(image, underlay, glyph, annotation, overlay)¶ Specify a position in the render order for a Bokeh renderer
-
RenderMode
= Enumeration(canvas, css)¶ Specify a render mode for renderers that support both Canvas or CSS rendering
-
RoundingFunction
= Enumeration(round, nearest, floor, rounddown, ceil, roundup)¶ Specify a policy for how numbers should be rounded
-
SizingMode
= Enumeration(stretch_both, scale_width, scale_height, scale_both, fixed)¶ Sizing mode policies
-
SliderCallbackPolicy
= Enumeration(continuous, throttle, mouseup)¶ Specify different callback policies for the slider widget
-
SortDirection
= Enumeration(ascending, descending)¶ Specify sorting directions
-
SpatialUnits
= Enumeration(screen, data)¶ Specify units for mapping values
-
StartEnd
= Enumeration(start, end)¶ Specify a start/end value
-
StepMode
= Enumeration(before, after, center)¶ Specify a mode for stepwise interpolation
-
TextAlign
= Enumeration(left, right, center)¶ Specify the horizontal alignment for rendering text
-
TextBaseline
= Enumeration(top, middle, bottom, alphabetic, hanging, ideographic)¶ Specify the baseline location for rendering text
-
VerticalLocation
= Enumeration(above, below)¶ Specify a vertical location in plot layouts
-
class
Enumeration
[source]¶ Represent an enumerated collection of values.
Note
Instances of
Enumeration
typically should not be constructed directly. Instead, use theenumeration()
function.