LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Interactive Data Visualization with Bokeh

Kurs anzeigen

Anleitung zur Übung

  • 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.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Import PolyAnnotation
____

# Create start and end dates
start_date = dt.datetime(2017, ____, ____)
end_date = dt.datetime(____, ____, ____)

# Create start and end floats
start_float = ____.____() * ____
end_float = ____.____() * ____
Code bearbeiten und ausführen