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

Connected

Exercise

Annotating Netflix stock price growth

As a reminder, you previously created dates and timestamps, displayed below:

start_date = dt.datetime(2017, 6, 30)
end_date = dt.datetime(2017, 7, 27)
start_float = start_date.timestamp() * 1000
end_float = end_date.timestamp() * 1000

The final steps to display the Netflix line plot with a polygon annotation are to subset the data for the stock price, call PolyAnnotation(), and add the annotation to the figure's layout.

Instructions

100 XP
  • Create start_data by subsetting netflix for the row where "date" equals start_date.
  • Repeat for end_data to get the close value from end_date.
  • Create polygon, fill in "green", with 0.4 transparency, and finish the xs and ys arguments.
  • Add polygon to the figure's layout.