<jupyter_start><jupyter_text>Bokeh plotting<jupyter_code>#imports for plot
from bokeh.io import output_notebook, push_notebook,show
from bokeh.plotting import figure, show
from bokeh.models import ColumnDataSource
from ipywidgets import interact
#This tels python to show the output in this notebook instead of in a html file
output_notebook()
# for later reference we make lists of our options
company_list = list(d.columns.levels[0])
## interactive legend 

company = company_list[0]
companysource = ColumnDataSource(d[company])
p = figure(x_axis_type='datetime',title=f'Graph with running means for {company}', \
    tools="pan,box_zoom,reset,save", y_axis_label='Closing price', x_axis_label='Date')

p.line(x='Date', y='Close', source=companysource, color = 'blue', legend= 'Closing price',muted_alpha=0.2)
p.line(x='Date', y='rm_200', source=companysource, color='black', line_dash='4 4', legend = '200 days',muted_alpha=0.2)
p.line(x='Date', y='rm_50', source=companysource, color='red', line_dash='4 4',legend = '50 days',muted_alpha=0.2)
p.legend.location = "top_left"
p.legend.click_policy="mute"

def update_name(company):
    p.title.text = 'Closing price and running mean of ' + str(company)
    companysource.data = ColumnDataSource(d[str(company)]).data
    push_notebook()
    
show(p,notebook_handle=True)


interact(update_name,company=company_list)
## interactive line

company = company_list[0]
companysource = ColumnDataSource(d[company])
p = figure(x_axis_type='datetime',title=f'Graph with running means for {company}', \
    tools="pan,box_zoom,reset,save", y_axis_label='Closing price', x_axis_label='Date')

p.line(x='Date', y='Close', source=companysource, color = 'blue', legend= 'Closing price')
p.line(x='Date', y='rm_200', source=companysource, color='black', line_dash='4 4', legend = '200 days')
p.line(x='Date', y='rm_50', source=companysource, color='red', line_dash='4 4',legend = '50 days')
p.legend.location = "top_left"



def update_name(company):
    p.title.text = 'Closing price and running mean of ' + str(company)
    companysource.data = ColumnDataSource(d[str(company)]).data
    push_notebook()
    
show(p,notebook_handle=True)


interact(update_name,company=company_list)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14393602843180808, 'fraction_numerical': 0.016437139049311416, 'mean_word_length': 6.98581560283688, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '274513', 'license': 'MIT', 'n_tokens_mistral': 800, 'n_tokens_neox': 763, 'n_words': 169, 'path': 'dataproject/dataproject/Askers rod/Using the download function.ipynb', 'repo_name': 'NumEconCopenhagen/projects-2019-unity', 'size': '2251'}