Created
February 29, 2020 10:56
-
-
Save databyjp/7fad76e4e9ef369f39da6e7e17d2d8ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment