In [1]:
#from bokeh import mpl
from bokeh.plotting import output_file, show, figure
from bokeh.io import output_notebook
from bokeh.charts import Scatter, show
#from bokeh.charts import Scatter, output_file, show
#from bokeh.sampledata.autompg import autompg as df
from bokeh.charts import defaults
from bokeh.models import Range1d
from bokeh.models import HoverTool
from bokeh.models.sources import ColumnDataSource
import pandas as pd
import numpy as np
In [ ]:
#file_path = '../data_in/Mdau_TE384_ANALYSIS_RESULTS.txt'
file_path = '../data_in/Ppip_TE384_ANALYSIS_RESULTS.txt'
#file_path = '../data_in/Myotis-Plecotus-Eptesicus_TE384_ANALYSIS_RESULTS.txt'
peak_df = pd.read_csv(file_path, sep="\t")
peak_df.head()
In [ ]:
output_notebook()
In [ ]:
#ds = ColumnDataSource(peak_df_2)
ds = ColumnDataSource(peak_df)
#hover = HoverTool(tooltips=[
# ("Time", "time_s"),
# ("Frequency", "frequency"),
# ("Amplitude", "amplitude")])
# TOOLS="hover"
TOOLS="wheel_zoom,box_zoom,undo,redo,reset,resize,pan,previewsave"
# TOOLS="undo,redo,resize,crosshair,pan,wheel_zoom,box_zoom,reset,tap,previewsave,box_select,poly_select,lasso_select"
p = figure(tools=TOOLS, toolbar_location="above")
p.title.text=file_path
p.plot_width = 1200 # 1800
p.plot_height = 600
s = p.scatter(source = ds, x='time_s', y='frequency_khz',
marker='circle',
# size='dbfs',
line_color="navy", fill_color="red", alpha=0.5,
)
p.xaxis.axis_label="Time (sec)"
p.yaxis.axis_label="Peak frequency (kHz)"
p.x_range = Range1d(0, 1, bounds=(0, 1))
p.y_range = Range1d(0, 100, bounds=(0, 150))
#hover = p.select_one(HoverTool)
#hover.point_policy = "follow_mouse"
#hover.tooltips = [
# ("Frequency (kHz)", "@frequency_khz"),
# ("dBFS ", "@dbfs"),
# ("Time (sec.) ", "@time_s")]
output_file("scatter.html")
show(p)
In [ ]:
In [ ]:
In [ ]: