1. Learn
  2. /
  3. Courses
  4. /
  5. Interactive Data Visualization with Bokeh

Exercise

Setting up a polygon annotation

A member of a hedge fund, who is an avid sports fan, saw your work for the sports media agency and has reached out as they need some plots produced for stock market analysis.

They are looking into the online media market and have provided you with a dataset called netflix, containing stock prices for Netflix. It has been stored as a source object called source and preloaded for you.

A figure, fig, has been created containing line glyphs. They would like you to highlight a period of significant growth. You plan to use a polygon annotation to draw attention to changes in Netflix's stock price in mid-2017 and add it to the line plot. To start, you need to create the start and end dates and timestamps.

Instructions

100 XP
  • Import PolyAnnotation.
  • Set start_date as 30th June 2017 and end_date as 27th July 2017.
  • Create start_float and end_float by calling .timestamp() and multiplying the result by 1000.