Bokeh - Styling Visual Attributes



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'
Advertisements