Session Ready
Exercise

Enhancing the plot with some shading

Now that you have the base plot ready, you can enhance it by coloring each circle glyph by continent.

Your job is to make a list of the unique regions from the data frame, prepare a ColorMapper, and add it to the circle glyph.

Instructions
100 XP
  • Make a list of the unique values from the region column. You can use the unique() and tolist() methods on data.region to do this.
  • Import CategoricalColorMapper from bokeh.models and the Spectral6 palette from bokeh.palettes.
  • Use the CategoricalColorMapper() function to make a color mapper called color_mapper with factors=regions_list and palette=Spectral6 (spelled with the letter l, not the number 16).
  • Add the color mapper to the circle glyph as a dictionary with dict(field='region', transform=color_mapper) as the argument passed to the color parameter of plot.circle(). Also set the legend parameter to be the 'region'.
  • Set the legend.location attribute of plot to 'top_right' (i.e. plot.____).