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.
Este exercício faz parte do curso
Interactive Data Visualization with Bokeh
Instruções do exercício
- Use
eastandwestto createeast_sizesandwest_sizes—dividingeast["blocks"]andwest["blocks"]by5, respectively. - Add circle glyphs to
figrepresenting points versus assists foreast; use a blue fill color, afill_alphaof0.3, a legend label of"East", and set theradiustoeast_sizes. - Repeat the above for
west, but fill in red, set a legend label of"West", and usewest_sizesto change the glyph size.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# 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)