Creating annotations to convey supplemental information
When creating plots it's fundamental to get across the story that the information in the plot is trying to convey. This can be done by adding titles, legends, and color maps to your plot.
Adding titles to plots
Titles are used to tell the reader about the overall story of the plot.
For the purposes of this chapter, we will use the S&P 500 stock data
found on Kaggle. (https://www.kaggle.com/camnugent/sandp500/data).
We will also filter the data to just information about Apple stocks, as illustrated in the following code:
#Import the required packages import pandas as pd #Read in the data df = pd.read_csv('all_stocks_5yr.csv') #Convert the date column into datetime data type df['date'] = pd.to_datetime(df['date']) #Filter the data for Apple stocks only df_apple = df[df['Name'] == 'AAL']
We will now store the required data in a ColumnDataSource
object by using the code shown here:
#Import the required packages from bokeh.io import...