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.
Este exercício faz parte do curso
Interactive Data Visualization with Bokeh
Instruções do exercício
- Import
PolyAnnotation. - Set
start_dateas 30th June 2017 andend_dateas 27th July 2017. - Create
start_floatandend_floatby calling.timestamp()and multiplying the result by1000.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# 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 = ____.____() * ____