LoslegenKostenlos loslegen

Big shooters

Traditionally, the tallest basketball players are in the center position, and they primarily shoot close to the basket. However, there has been a trend towards all positions shooting more three-point field goals in recent years.

The agency has a scatter plot visualizing "three_point_perc" versus "field_goal_perc" for centers and power forwards in the NBA. The dataset has been filtered for each position, and Bokeh source objects named centers and power_forwards have been preloaded for you. TOOLTIPS has also been created to display player names and average points per game.

The agency has asked you to change the plot's glyph settings to aid interpretation.

Diese Übung ist Teil des Kurses

Interactive Data Visualization with Bokeh

Kurs anzeigen

Anleitung zur Übung

  • Update the glyph attribute of center_glyphs and power_forward_glyphs to 20 pixels and 10 pixels, respectively.
  • Update the fill color attribute of center_glyphs and power_forward_glyphs to red and yellow, respectively.

Interaktive Übung

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

fig = figure(x_axis_label="Field Goal Percentage", y_axis_label="Three Point Field Goal Percentage", tooltips = TOOLTIPS)
center_glyphs = fig.circle(x="field_goal_perc", y="three_point_perc", source=centers, legend_label="Center", fill_alpha=0.2)
power_forward_glyphs = fig.circle(x="field_goal_perc", y="three_point_perc", source=power_forwards, legend_label="Power Forward", fill_color="green", fill_alpha=0.6)

# Update glyph size
center_glyphs.____.____ = ____
power_forward_glyphs.____.____ = ____

# Update glyph fill_color
center_glyphs.____.____ = "____"
power_forward_glyphs.____.____ = "____"
output_file(filename="big_shooters.html")
show(fig)
Code bearbeiten und ausführen