Bokeh 简明教程

Bokeh - Styling Visual Attributes

Bokeh 图表默认的外观可以通过设置各种属性为所需的值来进行定制。这些属性主要有三种类型 −

The default appearance of a Bokeh plot can be customised by setting various properties to desired value. These properties are mainly of three types −

Line properties

下表列出与线形形状有关的各种属性。

Following table lists various properties related to line glyph.

1

line_color

color is used to stroke lines with

2

line_width

This is used in units of pixels as line stroke width

3

line_alpha

Between 0 (transparent) and 1 (opaque) this acts as a floating point

4

line_join

how to join together the path segments. Defined values are: 'miter' (miter_join), 'round' (round_join), 'bevel' (bevel_join)

5

line_cap

how to terminate the path segments. Defined values are: 'butt' (butt_cap), 'round' (round_cap), 'square' (square_cap)

6

line_dash

BThis is used for a line style. Defined values are: 'solid', 'dashed', 'dotted', 'dotdash', 'dashdot'

7

line_dash_offset

The distance into the line_dash in pixels that the pattern should start from

Fill properties

下面列出了各种填充属性 −

Various fill properties are listed below −

1

fill_color

This is used to fill paths with

2

fill_alpha

Between 0 (transparent) and 1 (opaque), this acts as a floating point

Text properties

下表中列出了许多与文本相关的属性 −

There are many text related properties as listed in the following table −

1

text_font

font name, e.g., 'times', 'helvetica'

2

text_font_size

font size in px, em, or pt, e.g., '12pt', '1.5em'

3

text_font_style

font style to use 'normal' 'italic' 'bold'

4

text_color

This is used to render text with

5

text_alpha

Between 0 (transparent) and 1 (opaque), this is a floating point

6

text_align

horizontal anchor point for text - 'left', 'right', 'center'

7

text_baseline

vertical anchor point for text 'top', 'middle', 'bottom', 'alphabetic', 'hanging'