bokeh.core.enums#

Enum 属性一起使用的常见枚举。

此模块提供许多预定义的枚举,以及用于创建新枚举的函数。

可以使用 enumeration() 函数创建新的枚举。

#: Specify a nautically named side, port or starboard
MyEnum = enumeration("port", "starboard")

通常,枚举用于定义 Enum 属性。

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.
    """)

枚举具有定义的顺序并支持迭代

>>> for loc in MyEnum:
...     print(loc)
...
port
starboard

以及包含测试。

>>> "port" in MyEnum
True

可以使用 bokeh_enum Sphinx 扩展在 Sphinx 文档中轻松记录枚举。


enumeration(*values: Any, case_sensitive: bool = True, quote: bool = False) Enumeration[源代码]#

从值序列创建 enumeration() 对象。

使用值序列(唯一的)字符串调用 enumeration 以创建 Enumeration 对象。

#: Specify the horizontal alignment for rendering text
TextAlign = enumeration("left", "right", "center")
参数:
  • values (str) –

    字符串枚举值,作为位置参数传递。

    参数的顺序是枚举的顺序,第一个元素将被视为在用于创建 Enum 属性时的默认值。

  • case_sensitive (bool, 可选) – 验证是否应考虑大小写(默认值:True)

  • quote (bool, 可选) – 值是否应在字符串表示中加引号(默认值:False)

引发:

ValueError 如果值为空, 如果任何值不是字符串不唯一

返回值:

枚举


Align = Enumeration(start, center, end)#
AlternationPolicy = Enumeration(none, even, odd, every)#
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)#
AngleUnits = Enumeration(deg, rad, grad, turn)#
AutosizeMode = Enumeration(fit_columns, fit_viewport, force_fit, none)#
BuiltinFormatter = Enumeration(raw, basic, numeral, printf, datetime)#
ButtonType = Enumeration(default, primary, success, warning, danger, light)#
CalendarPosition = Enumeration(auto, above, below)#
ContextWhich = Enumeration(start, center, end, all)#
CoordinateUnits = Enumeration(canvas, screen, data)#
DashPattern = Enumeration(solid, dashed, dotted, dotdash, dashdot)#
DateFormat = Enumeration(ATOM, W3C, RFC-3339, ISO-8601, COOKIE, RFC-822, RFC-850, RFC-1036, RFC-1123, RFC-2822, RSS, TIMESTAMP)#
DatetimeUnits = Enumeration(microseconds, milliseconds, seconds, minsec, minutes, hourmin, hours, days, months, years)#
Dimension = Enumeration(width, height)#
Dimensions = Enumeration(width, height, both)#
Direction = Enumeration(clock, anticlock)#
FlowMode = Enumeration(block, inline)#
FontStyle = Enumeration(normal, italic, bold, bold italic)#
HAlign = Enumeration(left, center, right)#
HatchPattern = Enumeration(blank, dot, ring, horizontal .... zontal_wave, vertical_wave, criss_cross)#
查看所有值
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', '>', '*')#
HoldPolicy = Enumeration(combine, collect)#
HorizontalLocation = Enumeration(left, right)#
ImageOrigin = Enumeration(bottom_left, top_left, bottom_right, top_right)#
JitterRandomDistribution = Enumeration(uniform, normal)#
KeyModifier = Enumeration(shift, ctrl, alt)#
LabelOrientation = Enumeration(horizontal, vertical, parallel, normal)#
LatLon = Enumeration(lat, lon)#
LegendClickPolicy = Enumeration(none, hide, mute)#
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)#
LineCap = Enumeration(butt, round, square)#
LineDash = Enumeration(solid, dashed, dotted, dotdash, dashdot)#
LineJoin = Enumeration(miter, round, bevel)#
Location = Enumeration(above, below, left, right)#
MapType = Enumeration(satellite, roadmap, terrain, hybrid)#
MarkerType = Enumeration(asterisk, circle, circle_cro .... angle, triangle_dot, triangle_pin, x, y)#
查看所有值
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)
Movable = Enumeration(none, x, y, both)#
NamedColor = Enumeration(aliceblue, antiquewhite, aqu ....  white, whitesmoke, yellow, yellowgreen)#

指定其中一种 CSS4 命名的颜色 (https://www.w3.org/TR/css-color-4/#named-colors)

查看所有值
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)#
Orientation = Enumeration(horizontal, vertical)#
OutlineShapeName = Enumeration(none, box, rectangle, square, circle, ellipse, trapezoid, parallelogram, diamond, triangle)#

预定义轮廓形状的名称(在 Text.outline_shape 中使用)

OutputBackend = Enumeration(canvas, svg, webgl)#
PaddingUnits = Enumeration(percent, absolute)#
Palette = Enumeration(Accent3, Accent4, Accent5, A .... Rd5, YlOrRd6, YlOrRd7, YlOrRd8, YlOrRd9)#

指定来自 bokeh.palettes 的调色板的名称

查看所有值
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)
PanDirection = Enumeration(left, right, up, down, west, east, north, south)#

单击平移工具所作用的方向。

Place = Enumeration(above, below, left, right, center)#
RegionSelectionMode = Enumeration(replace, append, intersect, subtract, xor)#
RenderLevel = Enumeration(image, underlay, glyph, guide, annotation, overlay)#
ResetPolicy = Enumeration(standard, event_only)#
Resizable = Enumeration(none, left, right, top, bottom, x, y, all)#
ResolutionType = Enumeration(microseconds, milliseconds, seconds, minsec, minutes, hourmin, hours, days, months, years)#
RoundingFunction = Enumeration(round, nearest, floor, rounddown, ceil, roundup)#
ScrollbarPolicy = Enumeration(auto, visible, hidden)#
SelectionMode = Enumeration(replace, append, intersect, subtract, xor, toggle)#
SizingMode = Enumeration(stretch_width, stretch_height, stretch_both, scale_width, scale_height, scale_both, fixed, inherit)#
SizingPolicy = Enumeration(fixed, fit, min, max)#
SortDirection = Enumeration(ascending, descending)#
SpatialUnits = Enumeration(screen, data)#
StartEnd = Enumeration(start, end)#
StepMode = Enumeration(before, after, center)#
TextAlign = Enumeration(left, right, center)#
TextBaseline = Enumeration(top, middle, bottom, alphabetic, hanging, ideographic)#
TextureRepetition = Enumeration(repeat, repeat_x, repeat_y, no_repeat)#
ToolIcon = Enumeration(append_mode, arrow_down_to_b .... _zoom, y_grip, y_pan, zoom_in, zoom_out)#
查看所有值
Enumeration(append_mode, arrow_down_to_bar, arrow_up_from_bar,

    auto_box_zoom, bold, box_edit, box_select, box_zoom, caret_down,

    caret_left, caret_right, caret_up, check, chevron_down,

    chevron_left, chevron_right, chevron_up, clear_selection, copy,

    crosshair, delete, freehand_draw, fullscreen, help, hover,

    intersect_mode, invert_selection, italic, lasso_select, line_edit,

    maximize, minimize, pan, pin, point_draw, pointer, poly_draw,

    poly_edit, polygon_select, range, redo, replace_mode, reset, save,

    see_off, see_on, settings, square, square_check, subtract_mode,

    tap_select, text_align_center, text_align_left, text_align_right,

    undo, unknown, unpin, wheel_pan, wheel_zoom, x_box_select,

    x_box_zoom, x_grip, x_pan, xor_mode, y_box_select, y_box_zoom,

    y_grip, y_pan, zoom_in, zoom_out)
TooltipAttachment = Enumeration(horizontal, vertical, left, right, above, below)#
TooltipFieldFormatter = Enumeration(numeral, datetime, printf)#
TrackPolicy = Enumeration(auto, min, max, flex, fixed)#
VAlign = Enumeration(top, center, bottom)#
VerticalAlign = Enumeration(top, middle, bottom)#
VerticalLocation = Enumeration(above, below)#