Bokeh – Styling Visual Attributes

Bokeh - Styling Visual Attributes

In this chapter, we will discuss Bokeh – Styling Visual Attributes. The default appearance of a Bokeh plot can be customized by setting various properties to the desired value. These properties are mainly of three types −

Properties in Bokeh Styling Visual Attributes

Line properties

The following table lists various properties related to line glyph.

1line_colorcolor is used to stroke lines with
2line_widthThis is used in units of pixels as line stroke width
3line_alphaBetween 0 (transparent) and 1 (opaque) this acts as a floating point
4line_joinhow to join together the path segments. Defined values are: ‘miter’ (miter_join), ’round’ (round_join), ‘bevel’ (bevel_join)
5line_caphow to terminate the path segments. Defined values are: ‘butt’ (butt_cap), ’round’ (round_cap), ‘square’ (square_cap)
6line_dashBThis is used for a line style. Defined values are: ‘solid’, ‘dashed’, ‘dotted’, ‘dotdash’, ‘dashdot’
7line_dash_offsetThe distance into the line_dash in pixels that the pattern should start from

Fill properties

Various fill properties are listed below −

1fill_colorThis is used to fill paths with
2fill_alphaBetween 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 −

1text_fontfont name, e.g., ‘times’, ‘helvetica’
2text_font_sizefont size in px, em, or pt, e.g., ’12pt’, ‘1.5em’
3text_font_stylefont style to use ‘normal’ ‘italic’ ‘bold’
4text_colorThis is used to render text with
5text_alphaBetween 0 (transparent) and 1 (opaque), this is a floating point
6text_alignhorizontal anchor point for text – ‘left’, ‘right’, ‘center’
7text_baselinevertical anchor point for text ‘top’, ‘middle’, ‘bottom’, ‘alphabetic’, ‘hanging’

Next Topic – Click Here

This Post Has One Comment

Leave a Reply