LassoSelectTool の追加

Bokehで学ぶインタラクティブ・データビジュアライゼーション

George Boorman

Core Curriculum Manager, DataCamp

インスペクター

 

  • CrosshairTool
    • crosshair クロスヘアツール

 

 

  • HoverTool
    • hover ホバーツール

CrosshairTool

1 https://docs.bokeh.org/en/latest/docs/user_guide/tools.html#userguide-tools-inspectors
Bokehで学ぶインタラクティブ・データビジュアライゼーション

Bokeh のデータソースオブジェクト

from bokeh.models import ColumnDataSource

source = ColumnDataSource(data=nba)
fig = figure(x_axis_label="Minutes Played", y_axis_label="Points Per Game")
fig.circle(x="assists", y="points", source=source)
output_file(filename="ColumnDataSource.html") show(fig)

nba_scatter

Bokehで学ぶインタラクティブ・データビジュアライゼーション

HoverTool の設定

from bokeh.models import ColumnDataSource
source = ColumnDataSource(data=nba)

TOOLTIPS = [("Name", "@player"), ("Team", "@team")]
fig = figure(x_axis_label="Assists", y_axis_label="Points",
tooltips=TOOLTIPS)
fig.circle(x="assists", y="points", source=source) output_file("name_and_team.html") show(fig)
Bokehで学ぶインタラクティブ・データビジュアライゼーション

HoverTool の動作例

HoverTool

Bokehで学ぶインタラクティブ・データビジュアライゼーション

数値データの表示

TOOLTIPS = [("Name", "@player"), ("Team", "@team"),

("Points", "@points"), ("Assists", "@assists")]
fig = figure(x_axis_label="Assists", y_axis_label="Points", tooltips=TOOLTIPS) fig.circle(x="assists", y="points", source=source) output_file("hovertool.html") show(fig)

未整形の HoverTool

Bokehで学ぶインタラクティブ・データビジュアライゼーション

HoverTool の書式設定

TOOLTIPS = [("Name", "@player"), ("Team", "@team"),

("Points", "@points{0.2f}"), ("Assists", "@assists{0.2f}")]
fig = figure(x_axis_label="Assists", y_axis_label="Points", tooltips=TOOLTIPS) fig.circle(x="assists", y="points", source=source) output_file("formatted_hovertool.html") show(fig)

整形済み HoverTool

Bokehで学ぶインタラクティブ・データビジュアライゼーション

演習に進みましょう!

Bokehで学ぶインタラクティブ・データビジュアライゼーション

Preparing Video For Download...