In [23]:
import numpy as np
import pandas as pd
from IPython.core.display import HTML
import bokeh
print('Bokeh version:', bokeh.__version__)
In [24]:
df = pd.read_csv('stress_strain_data.csv', sep=',', header=None, skiprows=0)
df.columns = ['strain', 'stress']
df.head()
Out[24]:
In [25]:
import holoviews as hv
hv.extension('bokeh')
import bokeh
print('holovies version: ', hv.__version__)
print('bokeh version, ', bokeh.__version__)
In [26]:
hv.archive.auto()
scatter = hv.Curve(df, 'strain', 'stress')
scatter
Out[26]:
In [27]:
type(scatter)
Out[27]:
In [28]:
hv.archive.export()
In [29]:
from IPython.core.display import HTML
HTML('/home/tribilium/Documents/staticsite/content/code/tensiletest/indx.html')
Out[29]:
In [30]:
from bokeh.plotting import figure, output_file, show
from bokeh.models import ColumnDataSource, CDSView, IndexFilter
from bokeh.layouts import gridplot
output_file("index_filter.html")
source = ColumnDataSource(data=dict(x=[1, 2, 3, 4, 5], y=[1, 2, 3, 4, 5]))
view = CDSView(source=source, filters=[IndexFilter([0, 2, 4])])
tools = ["box_select", "hover", "reset"]
p = figure(plot_height=300, plot_width=300, tools=tools)
p.circle(x="x", y="y", size=10, hover_color="red", source=source)
p_filtered = figure(plot_height=300, plot_width=300, tools=tools)
p_filtered.circle(x="x", y="y", size=10, hover_color="red", source=source, view=view)
show(gridplot([[p, p_filtered]]))
In [31]:
from IPython.core.display import HTML
HTML('index_filter.html')
Out[31]:
In [ ]: