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 狮身人面像延伸。


enumeration(*values, **kwargs)[源代码]

创建一个 enumeration() 对象从一系列值中。

呼叫 enumeration 使用一系列(唯一)字符串创建枚举对象:

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

values (str) -- 字符串枚举值,作为位置参数传递参数参数参数的顺序是枚举的顺序,第一个元素在用于创建时将被视为默认值 Enum 性质。

关键字参数
  • case_sensitive (bool, optional) -- 验证是否应考虑大小写(默认值:True)

  • quote (bool, optional) -- 在字符串表示中是否应引用值(默认值:False)

引发

ValueError if values empty, if any value is not a string or not unique --

返回

枚举


Align = Enumeration(start, center, end)

子项的对齐(垂直或水平)

Anchor = Enumeration(top_left, top_center, top_right, center_left, center, center_right, bottom_left, bottom_center, bottom_right)

指定长方体/框架上的定位位置

AngleUnits = Enumeration(deg, rad)

指定角度值的单位

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

指定DataTable的自动调整大小模式

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

指定按钮小部件的样式

CalendarPosition = Enumeration(auto, above, below)

指定日期选取器日历的显示位置

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)

指定圆、楔体等的笔划方向。

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

指定用于呈现文本的字体样式

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

为填充填充图案指定一个内置填充图案

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', '>', '*')

使用一个字母的缩写指定填充图案填充的一个内置图案

缩写映射如下:

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

在打印布局中指定水平位置

JitterRandomDistribution = Enumeration(uniform, normal)

指定要用于抖动类的分布

LatLon = Enumeration(lat, lon)

指定标注或坐标是纬度还是经度

LegendClickPolicy = Enumeration(none, hide, mute)

指定图例应如何响应单击事件

LegendLocation = Enumeration(top_left, top_center, top_right, center_left, center, center_right, bottom_left, bottom_center, bottom_right)

指定Bokeh图例的固定位置

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)

指定Google地图的样式

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

指定一种内置标记类型

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, triangle, triangle_dot,

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

指定137个命名CSS颜色之一

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

指定某物的垂直/水平方向

OutputBackend = Enumeration(canvas, svg, webgl)

指定要在其上呈现绘图区域的输出后端

PaddingUnits = Enumeration(percent, absolute)

范围填充应解释为百分比还是绝对量

Palette = Enumeration(Accent3, Accent4, Accent5, A .... Rd5, YlOrRd6, YlOrRd7, YlOrRd8, YlOrRd9)

指定调色板的名称 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, 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, 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, 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, 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, Turbo3, Turbo4, Turbo5, Turbo6,

    Turbo7, Turbo8, Turbo9, Turbo10, Turbo11, Turbo256, 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)
RenderLevel = Enumeration(image, underlay, glyph, guide, annotation, overlay)

为Bokeh渲染器指定渲染顺序中的位置

RenderMode = Enumeration(canvas, css)

为同时支持画布或CSS渲染的渲染器指定渲染模式

ResetPolicy = Enumeration(standard, event_only)

在重设绘图时应进行哪些重置操作

RoundingFunction = Enumeration(round, nearest, floor, rounddown, ceil, roundup)

指定数字舍入方式的策略

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

选择模式

SizingMode = Enumeration(stretch_width, stretch_height, stretch_both, scale_width, scale_height, scale_both, fixed)

调整模式策略

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)

作为画布图案使用时应如何指定重复纹理

TickLabelOrientation = Enumeration(horizontal, vertical, parallel, normal)

指定轴刻度标签相对于轴的方向

TooltipAttachment = Enumeration(horizontal, vertical, left, right, above, below)

指定工具提示的附件

TooltipFieldFormatter = Enumeration(numeral, datetime, printf)

指定如何解释工具提示字段的格式字符串

TrackPolicy = Enumeration(auto, min, max, flex, fixed)

网格跟踪(行/列)大小调整策略

VerticalAlign = Enumeration(top, middle, bottom)

指定用于呈现文本的垂直对齐方式

VerticalLocation = Enumeration(above, below)

在打印布局中指定垂直位置

class Enumeration[源代码]

表示值的枚举集合。

注解

实例 Enumeration 通常不应直接施工。相反,使用 enumeration() 功能。