Get startedGet started for free

Highlighting by glyph size

The sports media agency you worked with previously has contacted you as they would like some more visualizations! They've requested a plot that uses different size glyphs to communicate about player statistics.

The nba dataset has been preloaded for you, and subset into two DataFrames, east and west, for the East and West conferences. You'll create a plot visualizing points against assists, with the glyph size depending on how many blocks per game a player averages.

This exercise is part of the course

Interactive Data Visualization with Bokeh

View Course

Exercise instructions

  • Use east and west to create east_sizes and west_sizes—dividing east["blocks"] and west["blocks"] by 5, respectively.
  • Add circle glyphs to fig representing points versus assists for east; use a blue fill color, a fill_alpha of 0.3, a legend label of "East", and set the radius to east_sizes.
  • Repeat the above for west, but fill in red, set a legend label of "West", and use west_sizes to change the glyph size.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create sizes
east_sizes = ____
west_sizes = ____
fig = figure(x_axis_label="Assists", y_axis_label="Points", title="NBA Points, Blocks, and Assists by Conference")

# Add circle glyphs for east
____

# Add circle glyphs for west
____

output_file(filename="size_contrast.html")
show(fig)
Edit and Run Code