Creating plots with ColumnDataSource
The ColumnDataSource
provides us with a way to use the same data across multiple plots and widgets. By feeding data into the ColumnDataSource
, you build a foundation of data that can be called upon whenever you please, instead of loading the data into your Jupyter Notebook multiple times.
Fundamentally, the ColumnDataSource
creates a dictionary in which the value is the data contained in the column and the key is a string name that you specify for that particular column.
Creating a time series plot using the ColumnDataSource
In order to construct a time series plot using the ColumnDataSource
, we use this code:
#Import the required packages from bokeh.io import output_file, show from bokeh.plotting import figure from bokeh.plotting import ColumnDataSource #Create the ColumnDataSource object data = ColumnDataSource(df_apple) #Create the time series plot plot = figure(x_axis_type = 'datetime', x_axis_label = 'date', y_axis_label = 'High Prices') plot...