Free throw percentage by position
The agency has asked for one final plot from you. You'll use factor_cmap to build a scatter plot visualizing free throw percentage versus average points, displaying each player position as a different color.
A source object called source has been created from the nba dataset and preloaded for you. The variable TOOLTIPS, containing the name of the player, has also been created, so it can be viewed when hovering the mouse over the plot.
Este exercício faz parte do curso
Interactive Data Visualization with Bokeh
Instruções do exercício
- Import
Category10_5andfactor_cmap. - Create
positions, a list containing"PG","SG","SF","PF", and"C". - Pass
"position"to thelegend_fieldargument and complete thefill_colorargument withinfig.circle().
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Import modules
____
____
# Create positions
positions = ["____", "____", "____", "____", "____"]
fig = figure(x_axis_label="Free Throw Percentage", y_axis_label="Points", title="Free Throw Percentage vs. Average Points", tooltips=TOOLTIPS)
# Add circle glyphs
fig.circle(x="free_throw_perc", y="points", source=source, legend_field="____", fill_color=factor_cmap("____", palette=____, factors=____))
output_file(filename="average_points_vs_free_throw_percentage.html")
show(fig)