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: Any, case_sensitive: bool = True, quote: bool = False) Enumeration[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)

  • quote (bool, optional) – Whether values should be quoted in the string representations (default: False)

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

AlternationPolicy = Enumeration(none, even, odd, every)#

Specify to which items apply styling in a container (e.g. in a legend)

Anchor = Enumeration(top_left, top_center, top_right, center_left, center_center, center_right, bottom_left, bottom_center, bottom_right, top, left, center, right, bottom)#

Specify an anchor position on a box/frame

AngleUnits = Enumeration(deg, rad, grad, turn)#

Specify the units for an angle value

AutosizeMode = Enumeration(fit_columns, fit_viewport, force_fit, none)#

Specify autosize mode for DataTable

ButtonType = Enumeration(default, primary, success, warning, danger, light)#

Specify a style for button widgets

CalendarPosition = Enumeration(auto, above, below)#

Specify a position for the DatePicker calendar to display

ContextWhich = Enumeration(start, center, end, all)#

Specify which tick to add additional context to

CoordinateUnits = Enumeration(canvas, screen, data)#

Specify units for mapping coordinates

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)#
Direction = Enumeration(clock, anticlock)#

Specify a stroke direction for circles, wedges, etc.

FlowMode = Enumeration(block, inline)#

Specify the flow behavior in CSS layouts.

FontStyle = Enumeration(normal, italic, bold, bold italic)#

Specify the font style for rendering text

HAlign = Enumeration(top, center, bottom)#

Horizontal alignment of a child item

HatchPattern = Enumeration(blank, dot, ring, horizontal .... zontal_wave, vertical_wave, criss_cross)#

Specify one of the built-in patterns for hatching fills

See all values
Enumeration(blank, dot, ring, horizontal_line, vertical_line, cross,

    horizontal_dash, vertical_dash, spiral, right_diagonal_line,

    left_diagonal_line, diagonal_cross, right_diagonal_dash,

    left_diagonal_dash, horizontal_wave, vertical_wave, criss_cross)
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)#
HorizontalLocation = Enumeration(left, right)#

Specify a horizontal location in plot layouts

ImageOrigin = Enumeration(bottom_left, top_left, bottom_right, top_right)#

Defines the coordinate space within an image

JitterRandomDistribution = Enumeration(uniform, normal)#
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, center_right, bottom_left, bottom_center, bottom_right, top, left, center, right, bottom)#

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)#
MapType = Enumeration(satellite, roadmap, terrain, hybrid)#

Specify a style for a Google map

MarkerType = Enumeration(asterisk, circle, circle_cro .... angle, triangle_dot, triangle_pin, x, y)#

Specify one of the built-in marker types

See all values
Enumeration(asterisk, circle, circle_cross, circle_dot, circle_x,

    circle_y, cross, dash, diamond, diamond_cross, diamond_dot, dot,

    hex, hex_dot, inverted_triangle, plus, square, square_cross,

    square_dot, square_pin, square_x, star, star_dot, triangle,

    triangle_dot, triangle_pin, x, y)
NamedColor = Enumeration(aliceblue, antiquewhite, aqu ....  white, whitesmoke, yellow, yellowgreen)#

Specify one of the CSS4 named colors (https://www.w3.org/TR/css-color-4/#named-colors)

See all values
Enumeration(aliceblue, antiquewhite, aqua, aquamarine, azure, beige,

    bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood,

    cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk,

    crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray,

    darkgreen, darkgrey, darkkhaki, darkmagenta, darkolivegreen,

    darkorange, darkorchid, darkred, darksalmon, darkseagreen,

    darkslateblue, darkslategray, darkslategrey, darkturquoise,

    darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue,

    firebrick, floralwhite, forestgreen, fuchsia, gainsboro,

    ghostwhite, gold, goldenrod, gray, green, greenyellow, grey,

    honeydew, hotpink, indianred, indigo, ivory, khaki, lavender,

    lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral,

    lightcyan, lightgoldenrodyellow, lightgray, lightgreen, lightgrey,

    lightpink, lightsalmon, lightseagreen, lightskyblue,

    lightslategray, lightslategrey, lightsteelblue, lightyellow, lime,

    limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue,

    mediumorchid, mediumpurple, mediumseagreen, mediumslateblue,

    mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue,

    mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive,

    olivedrab, orange, orangered, orchid, palegoldenrod, palegreen,

    paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink,

    plum, powderblue, purple, rebeccapurple, red, rosybrown,

    royalblue, saddlebrown, salmon, sandybrown, seagreen, seashell,

    sienna, silver, skyblue, slateblue, slategray, slategrey, snow,

    springgreen, steelblue, tan, teal, thistle, tomato, turquoise,

    violet, wheat, white, whitesmoke, yellow, yellowgreen)
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

See all values
Enumeration(Accent3, Accent4, Accent5, Accent6, Accent7, Accent8,

    Blues3, Blues4, Blues5, Blues6, Blues7, Blues8, Blues9, Blues256,

    Bokeh3, Bokeh4, Bokeh5, Bokeh6, Bokeh7, Bokeh8, BrBG3, BrBG4,

    BrBG5, BrBG6, BrBG7, BrBG8, BrBG9, BrBG10, BrBG11, Bright3,

    Bright4, Bright5, Bright6, Bright7, BuGn3, BuGn4, BuGn5, BuGn6,

    BuGn7, BuGn8, BuGn9, BuPu3, BuPu4, BuPu5, BuPu6, BuPu7, BuPu8,

    BuPu9, BuRd3, BuRd4, BuRd5, BuRd6, BuRd7, BuRd8, BuRd9,

    Category10_3, Category10_4, Category10_5, Category10_6,

    Category10_7, Category10_8, Category10_9, Category10_10,

    Category20_3, Category20_4, Category20_5, Category20_6,

    Category20_7, Category20_8, Category20_9, Category20_10,

    Category20_11, Category20_12, Category20_13, Category20_14,

    Category20_15, Category20_16, Category20_17, Category20_18,

    Category20_19, Category20_20, Category20b3, Category20b4,

    Category20b5, Category20b6, Category20b7, Category20b8,

    Category20b9, Category20b10, Category20b11, Category20b12,

    Category20b13, Category20b14, Category20b15, Category20b16,

    Category20b17, Category20b18, Category20b19, Category20b20,

    Category20c3, Category20c4, Category20c5, Category20c6,

    Category20c7, Category20c8, Category20c9, Category20c10,

    Category20c11, Category20c12, Category20c13, Category20c14,

    Category20c15, Category20c16, Category20c17, Category20c18,

    Category20c19, Category20c20, Cividis3, Cividis4, Cividis5,

    Cividis6, Cividis7, Cividis8, Cividis9, Cividis10, Cividis11,

    Cividis256, Colorblind3, Colorblind4, Colorblind5, Colorblind6,

    Colorblind7, Colorblind8, Dark2_3, Dark2_4, Dark2_5, Dark2_6,

    Dark2_7, Dark2_8, GnBu3, GnBu4, GnBu5, GnBu6, GnBu7, GnBu8, GnBu9,

    Greens3, Greens4, Greens5, Greens6, Greens7, Greens8, Greens9,

    Greens256, Greys3, Greys4, Greys5, Greys6, Greys7, Greys8, Greys9,

    Greys256, HighContrast3, Inferno3, Inferno4, Inferno5, Inferno6,

    Inferno7, Inferno8, Inferno9, Inferno10, Inferno11, Inferno256,

    Iridescent3, Iridescent4, Iridescent5, Iridescent6, Iridescent7,

    Iridescent8, Iridescent9, Iridescent10, Iridescent11,

    Iridescent12, Iridescent13, Iridescent14, Iridescent15,

    Iridescent16, Iridescent17, Iridescent18, Iridescent19,

    Iridescent20, Iridescent21, Iridescent22, Iridescent23, Light3,

    Light4, Light5, Light6, Light7, Light8, Light9, Magma3, Magma4,

    Magma5, Magma6, Magma7, Magma8, Magma9, Magma10, Magma11,

    Magma256, MediumContrast3, MediumContrast4, MediumContrast5,

    MediumContrast6, Muted3, Muted4, Muted5, Muted6, Muted7, Muted8,

    Muted9, OrRd3, OrRd4, OrRd5, OrRd6, OrRd7, OrRd8, OrRd9, Oranges3,

    Oranges4, Oranges5, Oranges6, Oranges7, Oranges8, Oranges9,

    Oranges256, PRGn3, PRGn4, PRGn5, PRGn6, PRGn7, PRGn8, PRGn9,

    PRGn10, PRGn11, Paired3, Paired4, Paired5, Paired6, Paired7,

    Paired8, Paired9, Paired10, Paired11, Paired12, Pastel1_3,

    Pastel1_4, Pastel1_5, Pastel1_6, Pastel1_7, Pastel1_8, Pastel1_9,

    Pastel2_3, Pastel2_4, Pastel2_5, Pastel2_6, Pastel2_7, Pastel2_8,

    PiYG3, PiYG4, PiYG5, PiYG6, PiYG7, PiYG8, PiYG9, PiYG10, PiYG11,

    Plasma3, Plasma4, Plasma5, Plasma6, Plasma7, Plasma8, Plasma9,

    Plasma10, Plasma11, Plasma256, PuBu3, PuBu4, PuBu5, PuBu6, PuBu7,

    PuBu8, PuBu9, PuBuGn3, PuBuGn4, PuBuGn5, PuBuGn6, PuBuGn7,

    PuBuGn8, PuBuGn9, PuOr3, PuOr4, PuOr5, PuOr6, PuOr7, PuOr8, PuOr9,

    PuOr10, PuOr11, PuRd3, PuRd4, PuRd5, PuRd6, PuRd7, PuRd8, PuRd9,

    Purples3, Purples4, Purples5, Purples6, Purples7, Purples8,

    Purples9, Purples256, RdBu3, RdBu4, RdBu5, RdBu6, RdBu7, RdBu8,

    RdBu9, RdBu10, RdBu11, RdGy3, RdGy4, RdGy5, RdGy6, RdGy7, RdGy8,

    RdGy9, RdGy10, RdGy11, RdPu3, RdPu4, RdPu5, RdPu6, RdPu7, RdPu8,

    RdPu9, RdYlBu3, RdYlBu4, RdYlBu5, RdYlBu6, RdYlBu7, RdYlBu8,

    RdYlBu9, RdYlBu10, RdYlBu11, RdYlGn3, RdYlGn4, RdYlGn5, RdYlGn6,

    RdYlGn7, RdYlGn8, RdYlGn9, RdYlGn10, RdYlGn11, Reds3, Reds4,

    Reds5, Reds6, Reds7, Reds8, Reds9, Reds256, Set1_3, Set1_4,

    Set1_5, Set1_6, Set1_7, Set1_8, Set1_9, Set2_3, Set2_4, Set2_5,

    Set2_6, Set2_7, Set2_8, Set3_3, Set3_4, Set3_5, Set3_6, Set3_7,

    Set3_8, Set3_9, Set3_10, Set3_11, Set3_12, Spectral3, Spectral4,

    Spectral5, Spectral6, Spectral7, Spectral8, Spectral9, Spectral10,

    Spectral11, Sunset3, Sunset4, Sunset5, Sunset6, Sunset7, Sunset8,

    Sunset9, Sunset10, Sunset11, TolPRGn3, TolPRGn4, TolPRGn5,

    TolPRGn6, TolPRGn7, TolPRGn8, TolPRGn9, TolRainbow3, TolRainbow4,

    TolRainbow5, TolRainbow6, TolRainbow7, TolRainbow8, TolRainbow9,

    TolRainbow10, TolRainbow11, TolRainbow12, TolRainbow13,

    TolRainbow14, TolRainbow15, TolRainbow16, TolRainbow17,

    TolRainbow18, TolRainbow19, TolRainbow20, TolRainbow21,

    TolRainbow22, TolRainbow23, TolYlOrBr3, TolYlOrBr4, TolYlOrBr5,

    TolYlOrBr6, TolYlOrBr7, TolYlOrBr8, TolYlOrBr9, Turbo3, Turbo4,

    Turbo5, Turbo6, Turbo7, Turbo8, Turbo9, Turbo10, Turbo11,

    Turbo256, Vibrant3, Vibrant4, Vibrant5, Vibrant6, Vibrant7,

    Viridis3, Viridis4, Viridis5, Viridis6, Viridis7, Viridis8,

    Viridis9, Viridis10, Viridis11, Viridis256, YlGn3, YlGn4, YlGn5,

    YlGn6, YlGn7, YlGn8, YlGn9, YlGnBu3, YlGnBu4, YlGnBu5, YlGnBu6,

    YlGnBu7, YlGnBu8, YlGnBu9, YlOrBr3, YlOrBr4, YlOrBr5, YlOrBr6,

    YlOrBr7, YlOrBr8, YlOrBr9, YlOrRd3, YlOrRd4, YlOrRd5, YlOrRd6,

    YlOrRd7, YlOrRd8, YlOrRd9)
Place = Enumeration(above, below, left, right, center)#
RenderLevel = Enumeration(image, underlay, glyph, guide, annotation, overlay)#

Specify a position in the render order for a Bokeh renderer

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

ScrollbarPolicy = Enumeration(auto, visible, hidden)#

Scrollbar policies

SelectionMode = Enumeration(replace, append, intersect, subtract)#

Selection modes

SizingMode = Enumeration(stretch_width, stretch_height, stretch_both, scale_width, scale_height, scale_both, fixed, inherit)#
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

ToolIcon = Enumeration(append_mode, box_edit, box_s .... eel_zoom, xpan, ypan, zoom_in, zoom_out)#

Well known tool icon names

See all values
Enumeration(append_mode, box_edit, box_select, box_zoom,

    clear_selection, copy, crosshair, freehand_draw, help, hover,

    intersect_mode, lasso_select, line_edit, pan, point_draw,

    poly_draw, poly_edit, polygon_select, range, redo, replace_mode,

    reset, save, subtract_mode, tap_select, undo, wheel_pan,

    wheel_zoom, xpan, ypan, zoom_in, zoom_out)
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

VAlign = Enumeration(left, center, right)#

Vertical alignment of a child item

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 the enumeration() function.