Bokeh 风格属性设置

http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#

使用Palettes

Palettes储存了一系列RGBA值来设置颜色地图。

>>> from bokeh.palettes import Spectral6
>>> Spectral6
['#3288bd', '#99d594', '#e6f598', '#fee08b', '#fc8d59', '#d53e4f']

可视化调色板

  1. line properties line color, width, etc.
  2. fill properties fill color, alpha, etc.
  3. text properties font styles, colors, etc.

Line Properties

  1. line_color
  2. line_width
  3. line_alpha
  4. line_join
  5. line_cap
  6. line_dash
  7. line_dash_offset

Fill Properties

  1. fill_color
  2. fill_alpha

Text Properties

  1. text_font
  2. text_font_size
  3. text_font_style
  4. text_color
  5. text_alpha
  6. text_align
  7. text_baseline

Visible Property

Specifying Colors

Styling Arrow Annotations

Selecting Plot Objects(选择做图对象)

Plots

Plot objects themselves have many visual characteristics that can be styled: the dimensions of the plot, backgrounds, borders, outlines, etc.

Dimensions

Responsive Dimensions

Title

from bokeh.plotting import figure, output_file, show

output_file("title.html")

p = figure(plot_width=400, plot_height=400, title="Some Title")
p.title.text_color = "olive"
p.title.text_font = "times"
p.title.text_font_style = "italic"

p.circle([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=10)

show(p)

Background

from bokeh.plotting import figure, output_file, show

output_file("background.html")

p = figure(plot_width=400, plot_height=400)
p.background_fill_color = "beige"
p.background_fill_alpha = 0.5

p.circle([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=10)

show(p)

Border

Outline

Glyphs

Selected and Unselected Glyphs

Hover Inspections

Tool Overlays

Axes

Labels

Bounds

Tick Locations

Tick Lines

Tick Label Formats

Tick Label Orientation

Grids

Lines

Minor Lines

Bands

Bounds

Legends

Location

Orientation

Label Text

Border

Background

Dimensions

标签