I am new to python and am looking for ways in which I can visualise data. I have come across 'Dash' - but wondered how I would show a graph based on data that is saved in a CSV?
Currently I have this.. But it only shows a blank graph.
Any help would be welcomed - thanks in advance.
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.express as px
import pandas as pd
df = pd.read_csv('d6.csv')
app = dash.Dash(__name__)
app.layout = html.Div([
dcc.Graph(id="graph"),
html.Button("Switch Axis", id='btn', n_clicks=0)
])
@app.callback(
Output("graph", "figure"),
[Input("btn", "n_clicks")])
def display_graph(n_clicks):
if n_clicks % 2 == 0:
x, y = 'Time', 'R1Temp'
else:
x, y = 'R1Temp', 'Time'
fig = px.line(df, x=x, y=y)
return fig
app.run_server(debug=False)