Bokeh is a Web browser designed for rendering in interactive visualization Python library. This is the core difference Bokeh with other visualization library.
-
Interactive specifically for the Web browser, visualization Python plotting library
-
Can be made as simple and beautiful interactive visualization D3.js, but with difficulty lower than D3.js.
-
HTML documents or standalone server program
-
It can handle large, dynamic flow data, or
-
Support Python (or Scala, R, Julia ...)
-
It does not require the use of Javascript
Bokeh Interface
-
Charts: high-level interface, a simple way to draw complex charts
-
Plotting: middle-level interface for assembling graphic elements
-
Models: low-level interface, providing maximum flexibility for developers
包引用from bokeh.io import output_notebook, output_file, showfrom bokeh.charts import Scatter, Bar, BoxPlot, Chordfrom bokeh.layouts import rowimport seaborn as snsexercise = sns.load_dataset('exercise')output_notebook()
-
from bokeh.io import output_file .html document generation
-
from boken.io import output_notebook in use in jupyter
Scatter Scatter
# 散点图p = Scatter(data=exercise, x='id', y='pulse', title='exercise dataset')show(p)
Histogram Bar
# 柱状图p = Bar(data=exercise, values='pulse', label='diet', stack='kind', title='exercise dataset')show(p)
Box Figure BoxPlot
# 盒子图box1 = BoxPlot(data=exercise, values='pulse', label='diet', color='diet', title='exercise dataset')box2 = BoxPlot(data=exercise, values='pulse', label='diet', stack='kind', color='kind', title='exercise dataset')show(row(box1, box2))
<ignore_js_op>弦图 Chord
# 弦图 Chordchord1 = Chord(data=exercise, source="id", target="kind")chord2 = Chord(data=exercise, source="id", target="kind", value="pulse")show(row(chord1, chord2))
<ignore_js_op>bokeh.plotting方框 square, 圆形 circle
from bokeh.plotting import figureimport numpy as npp = figure(plot_width=400, plot_height=400)# 方框p.square(np.random.randint(1,10,5), np.random.randint(1,10,5), size=20, color="navy")# 圆形p.circle(np.random.randint(1,10,5), np.random.randint(1,10,5), size=10, color="green")show(p)
<ignore_js_op>
更多技术资讯可关注:gzitcast