Created
April 9, 2018 20:47
-
-
Save sauercrowd/79348edf668b1d30bedcef6e946a5384 to your computer and use it in GitHub Desktop.
Plot dataframe with bokeh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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