Skip to content

Instantly share code, notes, and snippets.

@sauercrowd
Created April 9, 2018 20:47
Show Gist options
  • Save sauercrowd/79348edf668b1d30bedcef6e946a5384 to your computer and use it in GitHub Desktop.
Save sauercrowd/79348edf668b1d30bedcef6e946a5384 to your computer and use it in GitHub Desktop.
Plot dataframe with bokeh
from bokeh.models import ColumnDataSource
from bokeh.palettes import viridis
from bokeh.io import output_notebook, show
def plot(df, title='Prices'):
p = figure(title=title, plot_height=700, plot_width=1300)
output_notebook()
source = ColumnDataSource(df)
positions = df.columns
colors = viridis(len(positions))
i = 0
for pos in positions:
p.line(source=source,x='time', y=pos, color=colors[i], line_width=3, legend="- "+pos)
i+=1
show(p, notebook_handle=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment