39 lines
817 B
Python
Executable File
39 lines
817 B
Python
Executable File
import argparse
|
|
import plotly.graph_objects as go
|
|
import numpy
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('filename', help='Enter the sliced data filename')
|
|
args = parser.parse_args()
|
|
|
|
data = numpy.loadtxt(args.filename, delimiter="\t")
|
|
# The data is in row format
|
|
x = [i for i in range(len(data[0]))]
|
|
|
|
fig = go.Figure()
|
|
|
|
for line in data:
|
|
fig.add_trace(go.Bar(x=x, y=[d for d in line]))
|
|
|
|
steps = []
|
|
for i in range(len(fig.data)):
|
|
step = dict(
|
|
method="update",
|
|
args=[{'visible': [False] * len(fig.data)},
|
|
{'title': "Slider switched to step: " + str(i)}],)
|
|
step["args"][0]["visible"][i] = True
|
|
steps.append(step)
|
|
|
|
sliders = [dict(
|
|
active=0,
|
|
currentvalue={"prefix": "bin box "},
|
|
pad={"t": 50},
|
|
steps=steps)]
|
|
|
|
fig.update_yaxes(range=[0,0.2])
|
|
fig.update_layout(
|
|
sliders=sliders
|
|
)
|
|
fig.show()
|
|
|