Interactive Data Visualization with Bokeh
George Boorman
Core Curriculum Manager, DataCamp
fig = figure(x_axis_label="Rebounds", y_axis_label="Points") fig.circle(x="rebounds", y="points",
source=source, size=12)
output_file(filename="size_12_scatter.html") show(fig)
fig = figure(x_axis_label="Blocks", y_axis_label="Points") fig.circle(x="blocks", y="points", source=source, size=10,
line_color="red")
output_file(filename="red_lines.html") show(fig)
fig = figure(x_axis_label="Assists", y_axis_label="Blocks") fig.circle(x="blocks", y="points", source=source, size=12,
fill_color="red")
output_file(filename="red_circles.html") show(fig)
fig = figure(x_axis_label="Free Throw %", y_axis_label="Field Goal %") fig.circle(x="free_throw_perc", y="field_goal_perc", source=east, size=10,
fill_alpha=0.2, legend_label="East")
fig.circle(x="free_throw_perc", y="field_goal_perc", source=west, size=10, fill_alpha=0.2, fill_color="red", legend_label="West")
output_file(filename="transparent.html") show(fig)
fig = figure(x_axis_label="Steals", y_axis_label="Points")
circle = fig.circle(x="steals", y="assists", source=source, size=10, fill_color="green")
output_file(filename="original.html") show(fig)
circle.glyph.size = 20
circle.glyph.fill_color = "orange"
output_file(filename="updated.html") show(fig)
Scatter argument | Line plot equivalent |
---|---|
size |
line_width |
fill_alpha |
alpha |
color |
line_color |
fill_color |
Not applicable |
line_color |
Not applicable |
print(nba.iloc[:3, :6])
player position minutes field_goal_perc three_point_perc free_throw_perc
0 Russell Westbrook PG 34.6 0.425 0.343 0.845
1 James Harden PG 36.4 0.440 0.347 0.847
2 Isaiah Thomas PG 33.8 0.463 0.379 0.909
print(nba.iloc[:3, 6:])
rebounds assists steals blocks points team conference scorer_category
0 10.7 10.4 1.6 0.4 31.6 OKC West High Scorer
1 8.1 11.2 1.5 0.5 29.1 HOU West High Scorer
2 2.7 5.9 0.9 0.2 28.9 BOS East High Scorer
Interactive Data Visualization with Bokeh