Get startedGet started for free

Blocks vs. rebounds

You are working for a sports media agency that produces data journalism content such as blogs, analyses, and visualizations, primarily focused on basketball. The nba dataset has been preloaded for you and contains per-game statistics for basketball players in the 2017 season as well as their team, conference, and a label for their scoring ability.

The agency has asked you to produce a scatter plot displaying the relationship between blocks and rebounds.

This exercise is part of the course

Interactive Data Visualization with Bokeh

View Course

Exercise instructions

  • Import figure, output_file, and show from the two relevant Bokeh classes.
  • Create a new figure, fig, setting keyword arguments to label the x-axis as "Blocks per Game" and y-axis as "Rebounds per Game".
  • Add circle glyphs, setting x as nba["blocks"] and y as nba["rebounds"].
  • Call the function to produce the plot as an HTML file, setting the filename as "my_first_plot.html", and display the plot.

Hands-on interactive exercise

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

# Import required libraries
from ____.____ import ____
from ____.____ import ____, ____

# Create a new figure
fig = ____(x_axis_label="____", y_axis_label="____")

# Add circle glyphs
fig.____(x=____["____"], y=____["____"])

# Call function to produce html file and display plot
____(filename="____")
____(____)
Edit and Run Code