Session Ready
Exercise

A simple scatter plot

In this example, you're going to make a scatter plot of female literacy vs fertility using data from the European Environmental Agency. This dataset highlights that countries with low female literacy have high birthrates. The x-axis data has been loaded for you as fertility and the y-axis data has been loaded as female_literacy.

Your job is to create a figure, assign x-axis and y-axis labels, and plot female_literacy vs fertility using the circle glyph.

After you have created the figure, in this exercise and the ones to follow, play around with it! Explore the different options available to you on the tab to the right, such as "Pan", "Box Zoom", and "Wheel Zoom". You can click on the question mark sign for more details on any of these tools.

Note: You may have to scroll down to view the lower portion of the figure.

Instructions
100 XP
  • Import the figure function from bokeh.plotting, and the output_file and show functions from bokeh.io.
  • Create the figure p with figure(). It has two parameters: x_axis_label and y_axis_label.
  • Add a circle glyph to the figure p using the function p.circle() where the inputs are, in order, the x-axis data and y-axis data.
  • Use the output_file() function to specify the name 'fert_lit.html' for the output file.
  • Create and display the output file using show() and passing in the figure p.