LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Interactive Data Visualization with Bokeh

Kurs anzeigen

Anleitung zur Übung

  • 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.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# 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)
Code bearbeiten und ausführen