Skip to content

Instantly share code, notes, and snippets.

@app.callback(Output('datatable-subplots', 'figure'),
[Input('my-datatable', 'rows'),
Input('my-datatable', 'selected_row_indices')])
def update_figure(rows, selected_row_indices):
dff = pd.DataFrame(rows)
fig = plotly.tools.make_subplots(
rows=3, cols=1,
subplot_titles=('Beef', 'Pork', 'Poultry'),
shared_xaxes=True)
marker = {'color': ['#0074D9']*len(dff)}
# Create our app layout
app = dash.Dash(__name__)
server = app.server
app.layout = html.Div([
html.H2('My Dash App'),
dt.DataTable(
id='my-datatable',
rows=df_ag.to_dict('records'),
editable=False,
row_selectable=True,
# Import Supporting Libraries
import pandas as pd
# Import Dash Visualization Libraries
import dash_core_components as dcc
import dash_html_components as html
import dash_table_experiments as dt
import dash.dependencies
from dash.dependencies import Input, Output, State
import plotly