-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple_dash.py
executable file
·29 lines (24 loc) · 984 Bytes
/
simple_dash.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# ========== (c) JP Hwang 2020-02-28 ==========
import pandas as pd
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
all_teams_df = pd.read_csv('srcdata/shot_dist_compiled_data_2019_20.csv')
app = dash.Dash(__name__)
server = app.server
team_names = all_teams_df.group.unique()
team_names.sort()
app.layout = html.Div([
html.Div([dcc.Dropdown(id='group-select', options=[{'label': i, 'value': i} for i in team_names],
value='TOR', style={'width': '140px'})]),
dcc.Graph('shot-dist-graph', config={'displayModeBar': False})])
@app.callback(
Output('shot-dist-graph', 'figure'),
[Input('group-select', 'value')]
)
def update_graph(grpname):
import plotly.express as px
return px.scatter(all_teams_df[all_teams_df.group == grpname], x='min_mid', y='player', size='shots_freq', color='pl_pps')
if __name__ == '__main__':
app.run_server(debug=False)