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.


bokeh.core.enums.enumeration(*values, **kwargs)

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

bokeh.core.enums.Aggregation = Enumeration(sum, mean, count, nunique, median, min, max)

Specify an aggregation type

bokeh.core.enums.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

bokeh.core.enums.AngleUnits = Enumeration(deg, rad)

Specify the units for an angle value

bokeh.core.enums.ButtonType = Enumeration(default, primary, success, warning, danger, link)

Specify a style for button widgets

bokeh.core.enums.DashPattern = Enumeration(solid, dashed, dotted, dotdash, dashdot)

Specify a named dashing patter for stroking lines

bokeh.core.enums.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

bokeh.core.enums.DatetimeUnits = Enumeration(microseconds, milliseconds, seconds, minsec, minutes, hourmin, hours, days, months, years)

Specify a date/time scale

bokeh.core.enums.Dimension = Enumeration(width, height)

Specify a vertical/horizontal dimension

bokeh.core.enums.Dimensions = Enumeration(width, height, both)

Specify a vertical/horizontal dimensions

bokeh.core.enums.Direction = Enumeration(clock, anticlock)

Specify a stroke direction for circles, wedges, etc.

bokeh.core.enums.FontStyle = Enumeration(normal, italic, bold)

Specify the font style for rendering text

bokeh.core.enums.HorizontalLocation = Enumeration(left, right)

Specify a horizontal location in plot layouts

bokeh.core.enums.JitterRandomDistribution = Enumeration(uniform, normal)

Specify a distribution to use for the Jitter class

bokeh.core.enums.LatLon = Enumeration(lat, lon)

Specify whether a dimension or coordinate is latitude or longitude

bokeh.core.enums.LegendClickPolicy = Enumeration(none, hide, mute)

Specify how a legend should respond to click events

bokeh.core.enums.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

bokeh.core.enums.LineCap = Enumeration(butt, round, square)

Specify how stroked lines should be terminated

bokeh.core.enums.LineDash = Enumeration(solid, dashed, dotted, dotdash, dashdot)

Specify a named dash pattern for stroking lines

bokeh.core.enums.LineJoin = Enumeration(miter, round, bevel)

Specify how stroked lines should be joined together

bokeh.core.enums.Location = Enumeration(above, below, left, right)

Specify a location in plot layouts

bokeh.core.enums.MapType = Enumeration(satellite, roadmap, terrain, hybrid)

Specify a style for a Google map

bokeh.core.enums.NamedColor = Enumeration(aliceblue, antiquewhite, aqu .... white, whitesmoke, yellow, yellowgreen)

Specify one of the 137 named CSS 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, 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)
bokeh.core.enums.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

bokeh.core.enums.Orientation = Enumeration(horizontal, vertical)

Specify a vertical/horizontal orientation for something

bokeh.core.enums.OutputBackend = Enumeration(canvas, svg, webgl)

Specify an output backend to render a plot area onto

bokeh.core.enums.PaddingUnits = Enumeration(percent, absolute)

Whether range padding should be interpreted a percentage or and absolute quantity

bokeh.core.enums.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, BrBG3,

    BrBG4, BrBG5, BrBG6, BrBG7, BrBG8, BrBG9, BrBG10, BrBG11, BuGn3,

    BuGn4, BuGn5, BuGn6, BuGn7, BuGn8, BuGn9, BuPu3, BuPu4, BuPu5,

    BuPu6, BuPu7, BuPu8, BuPu9, 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,

    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, Greys3, Greys4,

    Greys5, Greys6, Greys7, Greys8, Greys9, Greys256, Inferno3,

    Inferno4, Inferno5, Inferno6, Inferno7, Inferno8, Inferno9,

    Inferno10, Inferno11, Inferno256, Magma3, Magma4, Magma5, Magma6,

    Magma7, Magma8, Magma9, Magma10, Magma11, Magma256, OrRd3, OrRd4,

    OrRd5, OrRd6, OrRd7, OrRd8, OrRd9, Oranges3, Oranges4, Oranges5,

    Oranges6, Oranges7, Oranges8, Oranges9, 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, 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, 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, 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)
bokeh.core.enums.RenderLevel = Enumeration(image, underlay, glyph, annotation, overlay)

Specify a position in the render order for a Bokeh renderer

bokeh.core.enums.RenderMode = Enumeration(canvas, css)

Specify a render mode for renderers that support both Canvas or CSS rendering

bokeh.core.enums.RoundingFunction = Enumeration(round, nearest, floor, rounddown, ceil, roundup)

Specify a policy for how numbers should be rounded

bokeh.core.enums.SizingMode = Enumeration(stretch_both, scale_width, scale_height, scale_both, fixed)

Sizing mode policies

bokeh.core.enums.SliderCallbackPolicy = Enumeration(continuous, throttle, mouseup)

Specify different callback policies for the slider widget

bokeh.core.enums.SortDirection = Enumeration(ascending, descending)

Specify sorting directions

bokeh.core.enums.SpatialUnits = Enumeration(screen, data)

Specify units for mapping values

bokeh.core.enums.StartEnd = Enumeration(start, end)

Specify a start/end value

bokeh.core.enums.StepMode = Enumeration(before, after, center)

Specify a mode for stepwise interpolation

bokeh.core.enums.TextAlign = Enumeration(left, right, center)

Specify the horizontal alignment for rendering text

bokeh.core.enums.TextBaseline = Enumeration(top, middle, bottom, alphabetic, hanging, ideographic)

Specify the baseline location for rendering text

bokeh.core.enums.TooltipFieldFormatter = Enumeration(numeral, datetime, printf)

Specify how a format string for a tooltip field should be interpreted

bokeh.core.enums.VerticalLocation = Enumeration(above, below)

Specify a vertical location in plot layouts

class bokeh.core.enums.Enumeration

Represent an enumerated collection of values.

Note

Instances of Enumeration typically should not be constructed directly. Instead, use the enumeration() function.