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
- Raises
ValueError if values empty, if any value is not a string or not unique –
- Returns
Enumeration
-
Align
= Enumeration(start, center, end)¶ Alignment (vertical or horizontal) of a child item
-
Anchor
= Enumeration(top_left, top_center, top_right, center_left, center, center_right, bottom_left, bottom_center, bottom_right)¶ Specify an anchor position on a box/frame
-
AngleUnits
= Enumeration(deg, rad)¶ Specify the units for an angle value
-
ButtonType
= Enumeration(default, primary, success, warning, danger)¶ Specify a style for button widgets
-
CalendarPosition
= Enumeration(auto, above, below)¶ Specify a position for the DatePicker calendar to display
-
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, TIMESTAMP)¶ Specify a format for printing dates
-
DatetimeUnits
= Enumeration(microseconds, milliseconds, seconds, minsec, minutes, hourmin, hours, days, months, years)¶ Specify a date/time scale
-
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, bold italic)¶ Specify the font style for rendering text
-
HatchPattern
= Enumeration(blank, dot, ring, horizontal .... zontal_wave, vertical_wave, criss_cross)¶ Specify one of the built-in patterns for hatching fills
-
HatchPatternAbbreviation
= Enumeration(' ', '.', 'o', '-', '|', '+', '"', ':', '@', '/', '\\', 'x', ',', '`', 'v', '>', '*')¶ Specify one of the built-in patterns for hatching fills with a one-letter abbreviation
The abbreviations are mapped as follows:
" " : blank "." : dot "o" : ring "-" : horizontal_line "|" : vertical_line "+" : cross '"' : horizontal_dash ":" : vertical_dash "@" : spiral "/" : right_diagonal_line "\\" : left_diagonal_line "x" : diagonal_cross "," : right_diagonal_dash "`" : left_diagonal_dash "v" : horizontal_wave ">" : vertical_wave "*" : criss_cross
-
HoldPolicy
= Enumeration(combine, collect)¶ Specify whether events should be combined or collected as-is when a Document hold is in effect
-
HorizontalLocation
= Enumeration(left, right)¶ Specify a horizontal location in plot layouts
-
JitterRandomDistribution
= Enumeration(uniform, normal)¶ Specify a distribution to use for the Jitter class
-
LatLon
= Enumeration(lat, lon)¶ Specify whether a dimension or coordinate is latitude or longitude
-
LegendClickPolicy
= Enumeration(none, hide, mute)¶ Specify how a legend should respond to click events
-
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
-
MarkerType
= Enumeration(asterisk, circle, circle_cross, circle_x, cross, dash, diamond, diamond_cross, hex, inverted_triangle, square, square_cross, square_x, triangle, x)¶ Specify one of the built-in marker types
-
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
-
OutputBackend
= Enumeration(canvas, svg, webgl)¶ Specify an output backend to render a plot area onto
-
PaddingUnits
= Enumeration(percent, absolute)¶ Whether range padding should be interpreted a percentage or and absolute quantity
-
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
-
ResetPolicy
= Enumeration(standard, event_only)¶ What reset actions should occur on a Plot reset
-
RoundingFunction
= Enumeration(round, nearest, floor, rounddown, ceil, roundup)¶ Specify a policy for how numbers should be rounded
-
SizingMode
= Enumeration(stretch_width, stretch_height, stretch_both, scale_width, scale_height, scale_both, fixed)¶ Sizing mode policies
-
SizingPolicy
= Enumeration(fixed, fit, min, max)¶ Individual sizing mode policies
-
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
-
TextureRepetition
= Enumeration(repeat, repeat_x, repeat_y, no_repeat)¶ Specify how textures used as canvas patterns should repeat
-
TickLabelOrientation
= Enumeration(horizontal, vertical, parallel, normal)¶ Specify how axis tick labels are oriented with respect to the axis
-
TooltipAttachment
= Enumeration(horizontal, vertical, left, right, above, below)¶ Specify an attachment for tooltips
-
TooltipFieldFormatter
= Enumeration(numeral, datetime, printf)¶ Specify how a format string for a tooltip field should be interpreted
-
TrackPolicy
= Enumeration(auto, min, max, flex, fixed)¶ Grid track (row/column) sizing policies
-
VerticalAlign
= Enumeration(top, middle, bottom)¶ Specify the vertical alignment 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.