Ejemplo n.º 1
0
    def get_loading_significance_table(self, group_key, theme=None, wrap=True):
        description = h5py.File(
            self.results_filename)[group_key].attrs['description']
        if self.results_file_ready:
            theme, style_header, style_cell = self._get_table_styles(theme)
            with h5py.File(self.results_filename, 'r') as file:
                feature_labels = np.array(file[group_key]['feature_labels'])
                loadings = np.array(
                    file[group_key]['pls']['x_loadings']).ravel()
                p_values = np.array(file[group_key]['feature_p_values'])
                alpha = file[group_key].attrs['outer_alpha']
                base_collection_id = file.attrs[
                    'input_collection_id'] if 'input_collection_id' in file.attrs else None
            x_min = x_max = None
            if base_collection_id is not None:
                try:
                    base_collection = get_collection(current_user,
                                                     int(base_collection_id))
                    x = base_collection.get_dataset('/x').ravel()
                    x_min = base_collection.get_dataset('/x_min').ravel()
                    x_max = base_collection.get_dataset('/x_max').ravel()
                    x_min = x_min[np.in1d(x, feature_labels)]
                    x_max = x_max[np.in1d(x, feature_labels)]
                except Exception as e:
                    x_min = x_max = None
            valid_bin_boundaries = (x_min is not None and x_max is not None
                                    and x_max.shape[0] == x_min.shape[0] ==
                                    feature_labels.shape[0])
            is_significant = p_values < alpha
            df = pd.DataFrame()
            df['Bin'] = feature_labels
            df['Loading'] = loadings
            if valid_bin_boundaries:
                df['Bin Max'] = x_max
                df['Bin Min'] = x_min
            df['p Value'] = p_values
            df['Significant'] = ['*' if s else '' for s in is_significant]
            df = df.sort_values(['Significant', 'Bin'],
                                ascending=[False, True])

            # format table for better display in browser
            df['p Value'] = df['p Value'].round(7).apply(
                lambda val: f'{val:.7f}')
            df['Bin'] = df['Bin'].round(4).apply(lambda val: f'{val:.4f}')
            df['Loading'] = df['Loading'].round(5).apply(
                lambda val: f'{val:.5f}')
            if valid_bin_boundaries:
                df['Bin Max'] = df['Bin Max'].round(4).apply(
                    lambda val: f'{val:.4f}')
                df['Bin Min'] = df['Bin Min'].round(4).apply(
                    lambda val: f'{val:.4f}')
            del df['Significant']
            df['Index'] = [str(i) for i in df.index]
            if valid_bin_boundaries:
                df = df[[
                    'Index', 'Bin Max', 'Bin', 'Bin Min', 'Loading', 'p Value'
                ]]
            else:
                df = df[['Index', 'Bin', 'Loading', 'p Value']]
            style_data_conditional = [{
                'if': {
                    'filter_query': f'{{p Value}} < {alpha}'
                },
                'backgroundColor': '#D2F9F1'
            }, {
                'if': {
                    'filter_query': f'{{p Value}} > {alpha}'
                },
                'backgroundColor': '#F9D9D2'
            }]
            table = dash_table.DataTable(
                id=f'feature-table',
                columns=[{
                    'name': i,
                    'id': i
                } for i in df.columns],
                data=df.to_dict('records'),
                style_table={
                    'height': '500px',
                    'overflowY': 'scroll'
                },
                fixed_rows={
                    'headers': True,
                    'data': 0
                },
                is_focused=True,
                style_data_conditional=style_data_conditional,
                style_header=style_header,
                style_cell=style_cell,
                style_cell_conditional=[
                    {
                        'if': {
                            'column_id': 'Index'
                        },
                        'width': f'{max(df.Index.str.len().max(), 5) + 2}ch'
                    },
                    {
                        'if': {
                            'column_id': 'Bin'
                        },
                        'width': f'{df.Bin.str.len().max() + 2}ch'
                    },
                    {
                        'if': {
                            'column_id': 'Bin Max'
                        },
                        'width': f'{df.Bin.str.len().max() + 2}ch'
                    },
                    {
                        'if': {
                            'column_id': 'Bin Min'
                        },
                        'width': f'{df.Bin.str.len().max() + 2}ch'
                    },
                    {
                        'if': {
                            'column_id': 'p Value'
                        },
                        'width': '12ch'
                    },
                ])
            if wrap:
                return html.Div(
                    [dbc.Row(html.H4(description)),
                     dbc.Row(table)])
            else:
                return table
        return [dash_table.DataTable(id='feature-table')]
def get_body():
    jumbotron = html.Div(
        [
            dbc.Collapse(
                id="collapse1",
                is_open=False,
            ),
            html.Div(html.Img(src=app.get_asset_url(config.image),
                              style={
                                  'width': '320px',
                                  'align': 'right',
                              }),
                     className='display-3'),
            html.P(
                "Applicatie voor het onderhouden van de projectstructuur",
                style={
                    'color': site_colors['indigo'],
                },
                className="lead",
            ),
            html.Hr(className="my-2"),
            dbc.Row([
                dbc.Col([
                    html.P(""),
                    html.P(""),
                    html.P(""),
                    html.H5("Werkwijze"),
                    html.P(""),
                    html.P(""),
                    html.P(""),
                    html.P("Onder het tabblad 'Projectstructuur - problemen' \
                            kan worden gefilterd op problemen in de projectstructuur.",
                           className="lead"),
                    html.
                    P("""Na de selectie van een probleem komen orders, bouwplannumers en/of projecten naar voren die \
                            vervolgens opgezocht kunnen worden
                        onder het tabblad 'Projectstructuur op project'.""",
                      className="lead"),
                    html.
                    P("Op deze pagina staat de uitleg van het probleem en de actie die ondernomen moet worden.",
                      className='lead'),
                    html.
                    P("Omvat de actie een aanpassing van het bouwplannummer in Connect, "
                      +
                      "dan kan dit worden aangepast op het tabblad 'Connect - Objectniveau'.",
                      className="lead"),
                    html.A(button(
                        "Klik hier om te beginnen",
                        backgroundcolor=site_colors['indigo'],
                    ),
                           href='/apps/datamanagement_problems/'),
                    html.P(""),
                    html.A(button(
                        "Download uitgebreide uitleg",
                        backgroundcolor=site_colors['indigo'],
                    ),
                           href='/download?type=pdf&value=explain'),
                    html.P(""),
                    html.A(
                        button(
                            "Reload data dashboard",
                            _id='reload_button',
                            backgroundcolor=site_colors['indigo'],
                        ))
                ]),
                dbc.Col([html.Div(update_cleanheid_tabel())]),
            ]),
        ],
        style={
            'margin-left': '5%',
            'margin-right': '5%',
            'margin-top': '2%',
            'margin-bottom': '2%',
            'backgroundColor': site_colors['grey20'],
            'border-style': 'solid solid solid solid',
            'border-color': '#BEBEBE',
            'border-width': '1px',
            'padding': '20px',
        },
    )
    return jumbotron
Ejemplo n.º 3
0
import dash_html_components as html
import dash_core_components as dcc

from layouts import heatmap, list_view

# Top level layout
layout = dbc.Container(
    [
        dbc.Container(html.H1("Spotify Trend Explorer"), fluid=True),
        html.Hr(),  # Horizontal line
        dbc.Row(
            [
                dbc.Col(
                    heatmap.layout,
                    width=7,
                ),  # className='column_left'
                dbc.Col(
                    list_view.layout,
                    width=5,
                )
            ],
            no_gutters=True),
        html.Hr(),  # Horizontal line
        dcc.Store(id='current_region', data=""),
        dcc.Store(id='selected_countries', data=""),
        dcc.Store(id='current_feature', data=""),
        dcc.Store(id='current_date'),
        dcc.Store(id='test'),
    ],
    fluid=True)
Ejemplo n.º 4
0
 dbc.Row(
     id="dropdown-row",
     children=[
         dbc.Col(children=[
             html.Label(
                 ['Select harmonic'],
                 style={
                     'font-weight': 'bold',
                     "text-align": "left"
                 }),
             dcc.Dropdown(
                 id="slct_harm",
                 options=[{
                     'label': x,
                     'value': x
                 } for x in harm_list],
                 style={
                     'width': '150px',
                     'vertical-align': "middle",
                     'color': 'black'
                 },
                 value='1',
                 multi=False,
             ),
             html.Span(id='harm_message',
                       className='badge badge-success'),
         ]),
         dbc.Col(children=[
             html.Label(
                 ['Select Slice'],
                 style={
                     'font-weight': 'bold',
                     "text-align": "left"
                 }),
             dcc.Dropdown(
                 id="slct_splice",
                 options=[{
                     'label': x,
                     'value': x
                 } for x in splice_option_list],
                 style={
                     'width': '250px',
                     'vertical-align': "middle",
                     'color': 'black'
                 },
                 placeholder='None',
             ),
             html.Span(id='splicing_message',
                       className='badge badge-success'),
         ]),
         dbc.Col(children=[
             html.Label(
                 ['Select Plotting Variable'],
                 style={
                     'font-weight': 'bold',
                     "text-align": "left"
                 }),
             dcc.Dropdown(
                 id="slct_plot",
                 options=[{
                     'label': x,
                     'value': x
                 } for x in plot_option_list],
                 style={
                     'width': '250px',
                     'vertical-align': "middle",
                     'color': 'black'
                 },
                 placeholder='None',
             ),
             html.Span(id='plot_message',
                       className='badge badge-success')
         ])
     ])
Ejemplo n.º 5
0
DEFAULT_RATIO = 0.1

app.layout = html.Div([

    html.Br(),
    html.Br(),
    html.Br(),

    html.Div(html.H1("Brief.Me"), style={'font-weight':'bold', 'color':'darkblue','text-align':'center'}),

    html.Br(),
    html.Br(),

    dbc.Row([

        dbc.Col(dbc.Input(id='url', type='url', size=30, placeholder="Type or copy/paste an URL"), width={'size':6, 'order':1, 'offset':3}),
        dbc.Col(dbc.Button("Summarize", id='button', n_clicks=1, color="primary", className="mr-1"), width={'order':2})

        ]),

    html.Br(),
    html.Br(),
    html.Br(),

    dbc.Row([

        dbc.Col(dcc.Loading(html.Div(html.H3(id="mainTitle"), style={'text-align':'center','font-weight':'bold'})), width={'size':6, 'offset':3})

    ]),

    html.Br(),
    html.Br(),
Ejemplo n.º 6
0
from dash import Dash, html, dcc, Output, Input, callback
import dash_bootstrap_components as dbc
import plotly.graph_objects as go
import pandas as pd

app = Dash(__name__, external_stylesheets=[dbc.themes.LUMEN])

df = pd.read_csv('https://raw.githubusercontent.com/Coding-with-Adam/Dash-by-Plotly/master/Dash_Interactive_Graphs/Candle_OHLC/oil_prices.csv')
df.Date = pd.to_datetime(df.Date)

app.layout = dbc.Container([
    html.H1('Candlestick vs OHLC Charts', style={'textAlign': 'center'}),

    dbc.Row([
        dbc.Col([html.Label('Volume of oil over:'),
                 dcc.Input(id='oil-volume', type='number', min=80000,
                           max=700000, step=10000, value=80000)
        ], width=4),
    ]),

    dbc.Row([
        dbc.Col([html.Label('CandleStick Chart')], width=dict(size=4, offset=2)),
        dbc.Col([html.Label('OHLC Chart')], width=dict(size=4, offset=2))
    ]),

    dbc.Row([
        dbc.Col([dcc.Graph(id='candle', figure={}, style={'height': '80vh'})], width=6),
        dbc.Col([dcc.Graph(id='ohlc', figure={}, style={'height': '80vh'})], width=6)
    ]),
], fluid=True)

Ejemplo n.º 7
0
    dark=True,
)

report_title = html.Div([
    dbc.Row([
        dbc.Col(
            html.Img(
                src=app.get_asset_url("cool-logo.png"),
                className="page-1a",
            )),
        dbc.Col(
            [
                html.H6("David Li"),
                html.H5("Financial Report"),
                html.H6(time.ctime()),
            ],
            className="page-1b",
        ),
        dbc.Col(
            [
                html.H6("Add Basic Auth"),
                html.H5("Add Stuff Later"),
                html.H6("Full Money Amount"),
            ],
            className="page-1e",
        ),
    ],
            className="page-1c")
],
                        className="page-1d")

if curr_env not in ["production"]:
Ejemplo n.º 8
0
                                                 primarycoin]
    # print(pairs)
    secondary_coin_dropdown = [{
        'label': str(x),
        'value': str(x)
    } for x in pairs.secondarycurrency.unique()]
    # print(secondary_coin_dropdown)
    return secondary_coin_dropdown


market_viz = html.Div([
    html.Div(id='market-object', style={'display': 'none'}),
    dbc.Row([
        dbc.Col(dcc.Dropdown(id='pricesource',
                             options=[o for o in markets_dropdown()],
                             value="BINANCE"),
                width=2),
        dbc.Col(dcc.Dropdown(id='primarycoin', value='ADA'), width=2),
        dbc.Col(dcc.Dropdown(id='secondarycoin', value='BTC'), width=2)
    ]),
    dbc.Row([
        dbc.Col(html.Div(id='coin-name'), style={'display': 'none'}),
        dbc.Col(html.Div(id='indicator-data'), style={'display': 'none'}),
        dbc.Col(html.Div(id='market-data-df'), style={'display': 'none'}),
    ]),
    dbc.Row(dbc.Col(dcc.Graph(id='market-data'))),
    dbc.Row(dbc.Col(dcc.Dropdown(id='indicators', options=get_indicators()))),
    dbc.Row([
        dbc.Col(
            dcc.Dropdown(id='botlist',
                         options=[o for o in custom_bots_dropdown()]))
    ])
Ejemplo n.º 9
0
def create_dashboard2(server):
    external_stylesheets = [dbc.themes.BOOTSTRAP]
    app = dash.Dash(__name__,
                    server=server,
                    url_base_pathname='/dashboard2/',
                    external_stylesheets=external_stylesheets)
    selected = []
    atc_list = get_atc()
    app.layout = html.Div(
        className='total-container',
        children=[
            dbc.Container(
                fluid=True,
                children=[
                    html.Div(className='header',
                             children=[
                                 html.H3(className='title',
                                         children="연관 약품 분석 (빈도/관련도)")
                             ]),
                    dbc.Row([
                        dbc.Col([
                            dbc.Card([
                                dbc.Label('단일/복합처방 선택'),
                                dcc.Dropdown(id='select1',
                                             className='select',
                                             options=[{
                                                 'label': '단일',
                                                 'value': 'single'
                                             }, {
                                                 'label': '복수',
                                                 'value': 'multi'
                                             }],
                                             placeholder='성분 개수',
                                             searchable=False),
                                dbc.Label('AND/OR 조건선택'),
                                dcc.Dropdown(id='select2',
                                             className='select',
                                             searchable=False),
                                dbc.Label('품목선택'),
                                dcc.Dropdown(
                                    id='elements',
                                    className='select',
                                    options=[{
                                        'label': str(a) + ' : ' + str(b),
                                        'value': str(a)
                                    } for a, b in zip(atc_list[0], atc_list[1])
                                             ],
                                    placeholder='원하는 성분 선택',
                                    disabled=False,
                                    multi=True,
                                    value=None,
                                    optionHeight=80,
                                ),
                                dbc.Label('지지도 설정'),
                                dcc.Slider(id='num',
                                           min=0.01,
                                           max=40,
                                           step=0.01,
                                           value=10,
                                           included=False,
                                           marks={
                                               i: str(i) + '%'
                                               for i in range(10, 41, 10)
                                           }),
                                html.Br(),
                                dbc.Button("연관 품목 조회",
                                           id="submit_button",
                                           n_clicks=0,
                                           color="primary",
                                           outline=True,
                                           block=True,
                                           loading_state={'is_loading': True}),
                                html.Br(),
                                dbc.Spinner(html.Div(id="alert-msg"))
                            ],
                                     body=True),
                        ],
                                md=3),
                        dbc.Col(
                            [
                                dbc.Row([
                                    dbc.Card([
                                        dbc.CardBody([
                                            dbc.Label('병용처방항목 필터링'),
                                            dcc.Dropdown(
                                                id='filter-freq-elements',
                                                options=[{
                                                    'label':
                                                    str(a) + ' : ' + str(b),
                                                    'value':
                                                    str(a)
                                                } for a, b in zip(
                                                    atc_list[0], atc_list[1])],
                                                placeholder='필터링할 성분 선택',
                                                disabled=False,
                                                multi=True)
                                        ])
                                    ],
                                             style={
                                                 'margin-bottom': '10px',
                                                 'width': '100%'
                                             }),
                                    dbc.Card(
                                        [
                                            dbc.CardBody([
                                                html.Div(
                                                    id='freq-download-button',
                                                    children=[
                                                        html.
                                                        A(html.
                                                          Button(
                                                              '다운로드',
                                                              n_clicks=0),
                                                          id='freq_csv_link',
                                                          href=
                                                          "/dashboard2/download_freq_csv"
                                                          ),
                                                        html.Span(
                                                            id='freq_len',
                                                            className=
                                                            'size_explain')
                                                    ]),
                                                dt.DataTable(
                                                    id='datatable-paging-freq',
                                                    columns=[{
                                                        'name': i,
                                                        'id': i,
                                                        'deletable': True
                                                    } for i in sorted(
                                                        df_freq.columns) if
                                                             i != 'total_set'],
                                                    page_current=0,
                                                    page_size=PAGE_SIZE,
                                                    page_action='custom',
                                                    sort_action='custom',
                                                    sort_mode='multi',
                                                    filter_action='custom',
                                                    filter_query='',
                                                    sort_by=[],
                                                    style_cell={
                                                        'whiteSpace': 'normal',
                                                        'height': 'auto'
                                                    },
                                                    style_table={
                                                        'minWidth': '100%',
                                                        'overflowX': 'auto'
                                                    })
                                            ])
                                        ],
                                        style={
                                            'width': '100%',
                                            'minHeight': '500px',
                                            'padding': '15px'
                                        })
                                ],
                                        style={'margin-bottom': '40px'
                                               }),  #,md=4
                                dbc.Row([
                                    dbc.Card([
                                        dbc.CardBody([
                                            dbc.Label('병용처방항목 필터링'),
                                            dcc.Dropdown(
                                                id='filter-asso-elements',
                                                options=[{
                                                    'label':
                                                    str(a) + ' : ' + str(b),
                                                    'value':
                                                    str(a)
                                                } for a, b in zip(
                                                    atc_list[0], atc_list[1])],
                                                placeholder='필터링할 성분 선택',
                                                disabled=False,
                                                multi=True)
                                        ])
                                    ],
                                             style={
                                                 'margin-bottom': '10px',
                                                 'width': '100%'
                                             }),
                                    dbc.Card(
                                        [
                                            dbc.CardBody([
                                                html.Div(
                                                    id='asso-download-button',
                                                    children=[
                                                        html.
                                                        A(html.
                                                          Button(
                                                              '다운로드',
                                                              n_clicks=0),
                                                          id='asso_csv_link',
                                                          href=
                                                          "/dashboard2/download_asso_csv"
                                                          ),
                                                        html.Span(
                                                            id='asso_len',
                                                            className=
                                                            'size_explain')
                                                    ]),
                                                dt.DataTable(
                                                    id='datatable-paging-asso',
                                                    columns=[
                                                        {
                                                            'name': i,
                                                            'id': i,
                                                            'deletable': True
                                                        } for i in sorted(
                                                            df_asso.columns)
                                                        if i != 'total_set'
                                                    ],
                                                    page_current=0,
                                                    page_size=PAGE_SIZE,
                                                    page_action='custom',
                                                    sort_action='custom',
                                                    sort_mode='multi',
                                                    filter_action='custom',
                                                    filter_query='',
                                                    sort_by=[],
                                                    style_cell={
                                                        'whiteSpace': 'normal',
                                                        'height': 'auto'
                                                    },
                                                    style_table={
                                                        'minWidth': '100%',
                                                        'overflowX': 'auto'
                                                    })
                                            ])
                                        ],
                                        style={
                                            'width': '100%',
                                            'minHeight': '500px',
                                            'padding': '15px'
                                        })
                                ])
                            ],
                            md=9)  #,md=5
                    ]),
                    html.Div(id='intermediate_freq', style={'display':
                                                            'none'}),
                    html.Div(id='intermediate_asso', style={'display': 'none'})
                ],
                style={"margin": "auto"})
        ])
    init_callback(app, atc_list)
    return app
Ejemplo n.º 10
0
 [
     dbc.Row(
         [
             dbc.Col(
                 [
                     html.H2("Heading 2"),
                     html.P(
                         """Donec id elit non mi porta gravida at eget metus.
                             Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum
                             nibh, ut fermentum massa justo sit amet risus. Etiam porta sem
                             malesuada magna mollis euismod. Donec sed odio dui. Donec id elit non
                             mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus
                             commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit
                             amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed
                             odio dui."""
                     ),
                     dbc.Button("View details", color="secondary"),
                 ],
                 md=4,
             ),
             dbc.Col(
                 [
                     html.H2("Graph"),
                     dcc.Graph(
                         figure={"data": [{"x": [1, 2, 3], "y": [1, 4, 9]}]}
                     ),
                 ]
             ),
         ]
     )
 ],
Ejemplo n.º 11
0
                          dark=False)

# Footer docs:
# dbc.Container, dbc.Row, dbc.Col: https://dash-bootstrap-components.opensource.faculty.ai/l/components/layout
# html.P: https://dash.plot.ly/dash-html-components
# fa (font awesome) : https://fontawesome.com/icons/github-square?style=brands
# mr (margin right) : https://getbootstrap.com/docs/4.3/utilities/spacing/
# className='lead' : https://getbootstrap.com/docs/4.3/content/typography/#lead
footer = dbc.Container(
    dbc.Row(
        dbc.Col(
            html.P(
                [
                    html.Span('Your Name', className='mr-2'),
                    html.A(html.I(className='fas fa-envelope-square mr-1'),
                           href='*****@*****.**'),
                    html.A(html.I(className='fab fa-github-square mr-1'),
                           href='https://github.com/dakotagporter'),
                    html.A(html.I(className='fab fa-linkedin mr-1'),
                           href='https://www.linkedin.com/in/dakotagporter'),
                    #html.A(html.I(className='fab fa-twitter-square mr-1'), href='https://twitter.com/<you>'),
                ],
                className='lead'))))

# Layout docs:
# html.Div: https://dash.plot.ly/getting-started
# dcc.Location: https://dash.plot.ly/dash-core-components/location
# dbc.Container: https://dash-bootstrap-components.opensource.faculty.ai/l/components/layout
app.layout = html.Div([
    dcc.Location(id='url', refresh=False), navbar,
    dbc.Container(id='page-content', className='mt-4'),
    html.Hr(), footer
Ejemplo n.º 12
0
        html.Hr(style={'border': '2px solid white'}),
        html.Br(),

        ## First two Graphs and jumbotron
        dbc.Row([
            dbc.Col(jumbotron, md=4),
            dbc.Col([
                dbc.Row([
                    dbc.Col(html.Div([
                        html.H3('Sum of Incidents'),
                        dcc.Graph(id='sum_indcident'),
                        html.Br()
                    ],
                                     style={'textAlign': 'center'}),
                            md=12),
                ]),
                dbc.Row([
                    dbc.Col(html.Div([
                        html.H3('Average of Incident %'),
                        dcc.Graph(id='avg_%')
                    ],
                                     style={'textAlign': 'center'}),
                            md=12)
                ])
            ],
                    md=8)
        ],
                align="center"),
        html.Br(),
        html.Br(),

        ## Total crimes % by race
Ejemplo n.º 13
0
              value=next(iter(datasets.keys()))),
 dbc.Row([
     dbc.Col(html.Div([html.H4("Linear: MDS"),
                       dcc.Graph(id='linear-mds')]),
             width=4),
     dbc.Col(html.Div([
         html.H4(id='tsne-1-header'),
         dcc.Graph(id='tsne-1'),
         dcc.Slider(id='tsne-1-slider',
                    min=5,
                    max=50,
                    step=1,
                    value=30,
                    marks={str(i): str(i)
                           for i in range(5, 51, 5)})
     ]),
             width=4),
     dbc.Col(html.Div([
         html.H4(id='umap-header'),
         dcc.Graph(id='umap'),
         dcc.Slider(id='umap-slider',
                    min=2,
                    max=29,
                    step=1,
                    value=15,
                    marks={str(i): str(i)
                           for i in range(2, 30, 3)})
     ]),
             width=4),
 ]),
 dbc.Row([
Ejemplo n.º 14
0
        #x=0.01
    ))
    #fig.update_layout(showlegend=False)
    fig.update_yaxes(title=None)
    fig.update_xaxes(title=None)
    #fig.update_yaxes(visible=True, showticklabels=True, title=False)
    #fig.update_xaxes(visible=False, showticklabels=True)
    return fig


body = dbc.Container(
    [
        dbc.Row([
            html.
            P("Projections for infections and deaths in Indian States and  for overall India are based in part on the model described in the following paper: ",
              style={
                  "color": "#151516",
                  "font-size": "20px"
              }),
        ]),
        dbc.Row([
            html.P(
                dcc.Link(
                    "Hidden Parameters Impacting Resurgence of SARS-CoV-2 Pandemic",
                    href=
                    "https://www.medrxiv.org/content/10.1101/2021.01.15.20248217v1",
                    target="_blank",
                    style={
                        "color": "#6211FF",
                        "font-size": "20px"
                    }))
        ]),
Ejemplo n.º 15
0
about_layout = html.Div([
    nav,
    html.Div(
        dbc.Container(
            dbc.Row(
                dcc.Markdown('''
# Uganda Covid-19 Dashboard
### Foreword
Hello and welcome, this is my second dashboard so far and I am borrowing implementations from my first dashboard to help speed things along which you can check out [here](https://african-covid19-dashboard.herokuapp.com/). The prime focus of this dashboard is as stated in the title to mainly visualize an overview of the 2019 Novel Coronavirus COVID-19 (2019-nCoV) epidemic as it relates to the Ugandan context.

This dashboard was built with Python using [Dash](https://dash.plotly.com/), with charts made in [Plotly](https://plotly.com/) and the Darkly theme of the app provided by [Bootswatch](https://bootswatch.com/darkly/).
 The code behind the dashboard  is available [here](https://github.com/TJMusiitwa/UG-Covid19-Dashboard).  I welcome any suggestions and pull requests to help add more features or improve upon the dashboard.

### Data
The data used in this dashboard is provided by the [Johns Hopkins Center for Systems Science and Engineering](https://github.com/CSSEGISandData/COVID-19) Coronavirus repository.

Further information was provided by the   [Ministry of Health](https://health.go.ug) & [Covid-19 Information Portal](https://covid19.gou.go.ug/)

### Inspiration
I would not have been able to create my this dashboard without some inspiration from the following sources, and I am highly grateful to them.

 - [COVID-19 Tracker](https://github.com/ncov19-us/front-end) 

### Contact
If you wish to contact me, I am available at this [email](mailto:[email protected])          
            '''),
                justify="center",
            ), ))
])
Ejemplo n.º 16
0
external_stylesheets = [
    'https://codepen.io/chriddyp/pen/bWLwgP.css', "/assets/style.css"
]
server = Flask(__name__)
app = dash.Dash(__name__,
                server=server,
                external_stylesheets=external_stylesheets)
app.title = "Araba grafiği çizme uygulaması"

app.layout = html.Div(
    html.Div([
        dbc.Row(
            dbc.Col(
                html.Iframe(src=app.get_asset_url("car.html"),
                            width="100%",
                            height="100px",
                            style={
                                'border': 'none',
                                'overflow': 'hidden'
                            }))),
        dbc.Row([
            dbc.Col([
                dcc.Graph(id='car-gra', figure=fig),
                dcc.Interval(id='refresh', interval=1000, n_intervals=0),
            ]),
        ])
    ]))


@server.route('/get-hiz', methods=['GET'])
def on_message():  # GET POST
Ejemplo n.º 17
0
        type="number",
        value=-1,
        min=-1,
        persistence=True,
        persistence_type="session",
    ),
    dbc.FormFeedback("", valid=True),
    dbc.FormFeedback("Timeout must be greater than or equal to -1",
                     valid=False),
    dbc.Tooltip(
        "Total experiment time. Set to -1 to run until stop is pressed.",
        target="timeout",
        placement="bottom",
    ),
])

layout = html.Div([
    dbc.Row(
        [
            dbc.Col(save_folder_input, width=6),
            dbc.Col(device_id_input, width=6)
        ],
        form=True,
    ),
    dbc.Row(
        [dbc.Col(interval_input, width=6),
         dbc.Col(timeout_input, width=6)],
        form=True,
    ),
])
Ejemplo n.º 18
0
column2 = dbc.Col([
    html.Pre("""
        
        
        """),
    html.Img(src=app.get_asset_url('multichart.png'),
             style={
                 'height': '30%',
                 'width': '30%',
                 'display': 'flex',
                 'textAlign': 'center',
                 'align-items': 'center',
                 'justify-content': 'center'
             }),
    dcc.Markdown("""
            For me the hardest part about this project was just deciding between classification or regression when it came down to this dataset. 
            I found that in the end regression seemed to do better with the dataset as well as the target I selected (“price”). 
            Looking back I could have used a bigger dataset that could have given us a more accurate prediction. 
  
            """)
], )

row1 = dbc.Row([column1])
row2 = dbc.Row([column2])

row = html.Div([
    dbc.Row([column1]),
])

layout = row
Ejemplo n.º 19
0
                     shares for money supply and quasi money were computed from broad money 
                     
                     """),
                     id="collapse_contribution",
                     is_open=False),
    ],
    body=True,
)

app.layout = html.Div([
    html.Br(),
    html.Br(),
    dbc.Row([
        dbc.Col(dropdown, md=12),
        dbc.Col(levels, lg=6),
        dbc.Col(growth, lg=6),
        dbc.Col(share, lg=6),
        dbc.Col(contribution, lg=6),
    ]),
])


@app.callback(Output(component_id='id_levels', component_property='figure'),
              [Input(component_id='id_holding', component_property='value')])
def levels(forex_holding):
    dff = df[df['Forex holding'].isin(forex_holding)]
    fig = px.line(
        dff,
        x='year',
        y='levels',
        color='Forex holding',
 dbc.Row(
     [
         dbc.Col(
             html.Div([
                 html.Br([]),
                 html.H5("Bienvenue!",
                         style={
                             'color': 'red',
                             'backgroundColor': 'white'
                         }),
                 html.Br([]),
                 html.P(
                     "\
                     Vous êtes sur la page d'acceuil du tutoriel de développement de dashbord en python avec Dash. \
                     Je vous présente ici les données du trafic web d'un site internet. Ce sont notamment les accès avec  \
                     differents appareils (mac, android, iphone_ipad, autre_pc) que vous pouvez visualiser ici sur\
                     2 mois (Octobre - novembre) grâce à un sélecteur de date dans la table ci-dessous.",
                     style={"color": "#000406"},
                 ),
                 html.P(
                     "\
                     Ces données ont par la suite été transformées pour interagir dynamiquement avec des graphiques. \
                     On y affiche des informations telles que: le nombre total d'accès à la plateform par appareil ,  \
                 les graphiques d'évolution des accès par appareil , par type d'appareil et par système d'exploitation sur plusieurs mois et années.\
                 Vous pouvez accéder au dashboard via la barre de navigation ou en cliquant directement ci-dessous.",
                     style={"color": "#000406"},
                 ),
                 dbc.Row([
                     #Navlink dashbord
                     dbc.NavLink("Accès Dashbsoard",
                                 href="/dashboard",
                                 style={'color': 'blue'})
                 ])
             ]),
             style={
                 'color': 'red',
                 'backgroundColor': 'white'
             })
     ],
     justify="center",
     align="center"),
Ejemplo n.º 21
0
import dash
import dash_core_components as dcc
import dash_bootstrap_components as dbc
import dash_html_components as html
from dash.dependencies import Input, Output
from resources import data_load

df_chalets = data_load.data_load_images_chalets()

tab_1_layout = dbc.Container([
    html.Br(),
    # Se Crea la PRIMERA FILA:
    dbc.Row([
        # La primera fila solo incluye UNA COLUMNA, esta columna
        # contiene el titulo de esta seccion:
        html.Div([
            html.H2('Featured Virtual Tours'),
        ],
                 style={'text-align': 'left'})
    ]),
    html.Hr(),  # Añade un linea horizontal

    # Se Crea la SEGUNDA FILA:
    dbc.Row([
        # Solo contiene un columna que incluye un elemento
        # MARKDOWN, que sera una pequeña descripcion de la seccion:
        dbc.Col(
            html.Div([
                dcc.Markdown(id='markdown',
                             children='''
                        Immerse yourself in the city of your dreams. Click on any of the following virtual tours of properties currently available for sale in the most emblematic areas of Miami. Find the house or condo right for you and contact us to coordinate an appointment.
                    ''')
Ejemplo n.º 22
0
# df = pd.read_csv('https://www.ncei.noaa.gov/access/services/data/v1?dataset=daily-summaries&dataTypes=TMAX,TMIN&stations=USW00023062&startDate=2019-01-01&endDate=' + today + '&units=standard').round(1)
# print(df.head())

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
app.config['suppress_callback_exceptions'] = True

# year list for dropdown selector
# year = []
# for YEAR in range(1950, current_year+1):
#     year.append({'label':(YEAR), 'value':YEAR})

body = dbc.Container([
    dbc.Row([
        dbc.Col(
            html.Div(className='app-header',
                     children=[
                         html.Div('DENVER TEMPERATURE RECORD',
                                  className="app-header--title"),
                     ]), ),
    ]),
    dbc.Row([
        dbc.Col(html.Div('Select Product'), width=4),
        dbc.Col(html.Div('Options')),
    ]),
    dbc.Row([
        dbc.Col(dcc.RadioItems(id='product',
                               options=[
                                   {
                                       'label': 'Daily data for a month',
                                       'value': 'daily-data-month'
                                   },
                                   {
Ejemplo n.º 23
0
        'border': 'thick grey solid',
        'overflow': 'scroll',
    }
}
################################################################################################################################################################
cheating_button = html.Div([
    dbc.Row([
        dbc.Col([
            dbc.Button("Click to view decision based on previous experience",
                       id="open-cheating-modal",
                       size="lg",
                       color="primary"),
            html.Br(),
            dbc.Modal([
                dbc.ModalHeader("Decision"),
                dbc.ModalBody(html.H3("Retail Shorts USA")),
                dbc.ModalFooter(dbc.Button("Close", id="close-cheating-modal"))
            ],
                      id="cheating-modal",
                      size="lg",
                      centered=True)
        ],
                width={"size": 11}),
    ],
            justify="center"),
    dbc.Row([dbc.Col([html.Br(), html.Br()])])
])
'''
@app.callback(
    [Output("open-cheating-modal", "disabled"),
    Output("open-modal1", "disabled"),
Ejemplo n.º 24
0
def barplt_players(data,feat):
    data_names= data.columns.tolist()
    data_names.remove(feat)
    
    fig = px.bar(data.sort_values(by=[feat]), x='Player', y=str(feat),
                hover_data= ['Player','Team'],color=feat,text = feat)
    fig.show()


# App Layout
app.layout = html.Div(
    [



        dbc.Row(dbc.Col(html.H1(children ="NBA 2K Analysis", className = 'banner', style ={'fontSize' : 100,'color':'Purple',
            'font-family':'monospace','textAlign': 'center'})),align="center",),
        # Left dropdown for team 1

        html.Div([
            dcc.Markdown('''# Select First Team '''),
                dcc.Dropdown(
                    id = 'team1',
                    options = [{'label': i, 'value': i} for i in teams],
                    value = 'Kings Guard Gaming'),

        # Middle dropdown for team 2
            dcc.Markdown('''# Select Second Team'''),
                dcc.Dropdown(
                    id = 'team2',
                    options = [{'label': i, 'value': i} for i in teams],
                    value = '76ers GC'
Ejemplo n.º 25
0
                'label': 'Pike',
                'value': 'Pike'
            },
            {
                'label': 'State Highway',
                'value': 'State Highway'
            },
            {
                'label': 'Toll',
                'value': 'Toll'
            },
            {
                'label': 'Trail',
                'value': 'Trail'
            },
            {
                'label': 'Bridge',
                'value': 'Bridge'
            },
            {
                'label': 'Throughway',
                'value': 'Throughway'
            },
        ],
        value='Avenue',
        className='mb-5',
    ),
], )

layout = dbc.Row([column1, column2])
Ejemplo n.º 26
0
datatable = html.Div(
    id="A4fake",
    children=[],
)

#-------------------------------------------------------------------------------------
styles = {'pre': {'border': 'thin lightgrey solid', 'overflowX': 'scroll'}}

#LAYOUT LAYOUT LAYOUT LAYOUT LAYOUT LAYOUT LAYOUT LAYOUT LAYOUT LAYOUT LAYOUT LAYOUT
body = html.Div([
    dbc.Row([
        dbc.Col([
            dbc.Row([
                dbc.Col([interactiveA1], width=3),
                dbc.Col([outputA1], width=9),
            ]),
        ],
                width=6),
        dbc.Col([dropdownA2scale, outputA2], width=6),
    ]),
    dbc.Row(
        [
            html.Div(
                className='row',
                children=[
                    html.Div([
                        html.P("""testing"""),
                        html.Pre(id='selected-datafake', style=styles['pre']),
                        #datatable
                    ])
                    #], className='three columns'),
Ejemplo n.º 27
0
 dbc.Row([
     dbc.Col([
         html.Div([
             dbc.Row([
                 dbc.Col([
                     html.Div([
                         dcc.Dropdown(
                             id='mRoleChooser',
                             options=[{
                                 'label': i,
                                 'value': i
                             } for i in
                                      ["Data Analyst", "Network Engineer"]],
                             value="Data Analyst")
                     ])
                 ]),
                 dbc.Col([
                     html.Div([
                         dcc.Dropdown(id='month_end',
                                      options=[{
                                          'label': i,
                                          'value': i
                                      } for i in daDf.columns],
                                      value='September')
                     ])
                 ])
             ]),
             html.Div(id="dtbl")
         ])
     ])
 ])
Ejemplo n.º 28
0
def update_charts(
    indicator,
    continents,
    yrs,
    theme,
    template,
    color_discrete,
    color_continuous,
    checkbox,
):
    if continents == [] or indicator is None:
        return {}

    color_discrete = color_discrete.split(": ")[1].strip()
    color_continuous = color_continuous.split(": ")[1].strip()
    line_colors = util.discrete_colors[color_discrete]
    if checkbox == []:
        line_colors = None
        color_continuous = None
    if template == "bootstrap":
        template = util.url_dbc_themes[theme].lower()

    dff = df[df.year.between(yrs[0], yrs[1])]
    dff = dff[dff.continent.isin(continents)]
    line_fig = px.line(
        dff,
        x="year",
        y=indicator,
        color="continent",
        line_group="country",
        template=template,
        color_discrete_sequence=line_colors,
    )

    dff = dff[dff.year == yrs[1]]
    scatter_fig = px.scatter(
        dff,
        x="lifeExp",
        y=indicator,
        size="pop",
        color="pop",
        size_max=60,
        template=template,
        color_continuous_scale=color_continuous,
    ).update_traces(marker_opacity=0.8)

    avg_lifeExp = (dff["lifeExp"] * dff["pop"]).sum() / dff["pop"].sum()
    map_fig = px.choropleth(
        dff,
        locations="iso_alpha",
        color="lifeExp",
        template=template,
        title="%.0f World Average Life Expectancy was %.1f years" %
        (yrs[1], avg_lifeExp),
    )

    hist_fig = px.histogram(dff,
                            x="lifeExp",
                            nbins=10,
                            title="Life Expectancy",
                            template=template)

    return html.Div([
        dbc.Row([
            dbc.Col(dcc.Graph(figure=line_fig), lg=6),
            dbc.Col(dcc.Graph(figure=scatter_fig), lg=6),
        ]),
        dbc.Row([
            dbc.Col(dcc.Graph(figure=hist_fig), lg=6),
            dbc.Col(dcc.Graph(figure=map_fig), lg=6),
        ]),
    ])
Ejemplo n.º 29
0
def tableview_bundle():
    return html.Div([
        dbc.Row([
            dbc.Col(
                [
                    html.Div([
                        html.H4("Filter",
                                style={
                                    "font-size": "1rem",
                                    "padding-left": "0.5rem",
                                    "padding-top": "0.5rem"
                                }),
                        #									html.H5("Filter 1", style={"font-size":"0.8rem","color":"#919191","padding-left":"0.5rem", "padding-top":"0.5rem"}),
                        dcc.Dropdown(
                            id=
                            "drilldown-dropdown-dimension-filter-selection-bundle",
                            options=
                            #										[{"label": 'Service Category', "value": 'Service Category'}] +
                            [{
                                "label": k,
                                "value": k,
                                'disabled': True
                            } if len(dimension_bundle[k]) == 0 else {
                                "label": k,
                                "value": k,
                                'disabled': False
                            } for k in list(dimension_bundle.keys())],
                            placeholder="Add a Filter",
                            style={"font-family": "NotoSans-Condensed"}),
                        html.H5("", style={"font-size": "0.8rem"}),
                        dcc.Dropdown(
                            id="drilldown-dropdown-dimension-filter-bundle",
                            placeholder="Select Filter Value",
                            multi=True,
                            style={"font-family": "NotoSans-Condensed"},
                        ),
                        html.H4("Select dimension",
                                style={
                                    "font-size": "1rem",
                                    "padding-left": "0.5rem",
                                    "padding-top": "0.5rem"
                                }),
                        html.H5("First dimension",
                                style={
                                    "font-size": "0.8rem",
                                    "color": "#919191",
                                    "padding-left": "0.5rem",
                                    "padding-top": "0.5rem"
                                }),
                        dcc.Dropdown(
                            id="drilldown-dropdown-dimension-1-bundle",
                            placeholder="...",
                            options=[{
                                "label": 'Service Category',
                                "value": 'Service Category'
                            }] + [{
                                "label": k,
                                "value": k,
                                'disabled': True
                            } if len(dimension_bundle[k]) == 0 else {
                                "label": k,
                                "value": k,
                                'disabled': False
                            } for k in list(dimension_bundle.keys())],
                            value='Bundle Name',
                            clearable=False,
                            style={"font-family": "NotoSans-Condensed"}),
                        html.H5("", style={"font-size": "0.8rem"}),
                        dcc.Dropdown(
                            id="drilldown-dropdown-dimension-filter-1-bundle",
                            placeholder="Select Filter Value",
                            multi=True,
                            style={"font-family": "NotoSans-Condensed"},
                        ),
                        html.H5("Second dimension",
                                style={
                                    "font-size": "0.8rem",
                                    "color": "#919191",
                                    "padding-left": "0.5rem",
                                    "padding-top": "0.5rem"
                                }),
                        dcc.Dropdown(
                            id="drilldown-dropdown-dimension-2-bundle",
                            disabled=True,
                            placeholder="...",
                            style={"font-family": "NotoSans-Condensed"}),
                        html.H5("", style={"font-size": "0.8rem"}),
                        dcc.Dropdown(
                            id="drilldown-dropdown-dimension-filter-2-bundle",
                            placeholder="Select Filter Value",
                            multi=True,
                            style={"font-family": "NotoSans-Condensed"},
                        ),
                        html.H5("Third dimension_bundle",
                                style={
                                    "font-size": "0.8rem",
                                    "color": "#919191",
                                    "padding-left": "0.5rem",
                                    "padding-top": "0.5rem"
                                }),
                        dcc.Dropdown(
                            id="drilldown-dropdown-dimension-3-bundle",
                            disabled=True,
                            placeholder="...",
                            style={"font-family": "NotoSans-Condensed"}),
                        html.H5("", style={"font-size": "0.8rem"}),
                        dcc.Dropdown(
                            id="drilldown-dropdown-dimension-filter-3-bundle",
                            placeholder="Select Filter Value",
                            multi=True,
                            style={"font-family": "NotoSans-Condensed"},
                        ),
                        html.H4("Select measure_bundles",
                                style={
                                    "font-size": "1rem",
                                    "padding-left": "0.5rem",
                                    "padding-top": "1rem"
                                }),
                        dcc.Dropdown(
                            id="drilldown-dropdown-measure-1-bundle",
                            options=[{
                                "label":
                                k,
                                "value":
                                k
                            } for k in measure_bundle],
                            value=[
                                'Diff % from Benchmark Total Cost/Bundle',
                                'YTD Total Cost/Bundle',
                                'Annualized Total Cost/Bundle',
                                'Benchmark Total Cost/Bundle'
                            ],
                            placeholder="Select measures",
                            multi=True,
                            style={"font-family": "NotoSans-Condensed"}),
                    ]),
                ],
                width=3,
                style={"overflow-y": "scroll"}),
            dbc.Col(
                [
                    html.Div(
                        [
                            html.
                            P("*Default sorted by Diff % from Benchmark Total Cost/Episode",
                              style={"font-size": "0.6rem"}),
                            dash_table.DataTable(
                                id='drilldown-datatable-tableview-bundle',
                                style_header={
                                    'height': 'auto',
                                    'width': 'auto',
                                    'whiteSpace': 'normal',
                                    'font-family': 'NotoSans-Condensed',
                                    'font-size': 'auto',
                                    'backgroundColor': '#dce7fc',
                                    'color': '#1357DD'
                                },
                                style_cell={
                                    'font-family': 'NotoSans-Regular',
                                    'font-size': '0.8rem',
                                    'textAlign': 'center'
                                },
                                #fixed_rows={ 'headers': True, 'data': 0 },
                                style_table={'textAlign': 'center'},
                                sort_action='native',
                                page_size=200,
                                style_data_conditional=[{
                                    'if': {
                                        'row_index': 'odd'
                                    },
                                    'backgroundColor':
                                    'rgb(248, 248, 248)'
                                }],
                            )
                        ],
                        style={
                            "padding-left": "1rem",
                            "padding-right": "1rem",
                            "padding-bottom": "1rem",
                            "overflow": "scroll",
                            'max-height': '60rem'
                        })
                ],
                width=9,
            ),
        ])
    ])
Ejemplo n.º 30
0
    def get_quality_plot(self, group_key, theme=None, wrap=True):
        """ This gets the bar plot and the scores plot"""
        is_discrimination = 'accuracy' in h5py.File(
            self.results_filename)[group_key].attrs
        description = h5py.File(
            self.results_filename)[group_key].attrs['description']
        theme = theme or 'plotly_white'

        labels = [
            'R\u00B2Y',
            'R\u00B2X',
            'Q\u00B2Y',
        ]
        colors = [
            DEFAULT_PLOTLY_COLORS[0], DEFAULT_PLOTLY_COLORS[0],
            DEFAULT_PLOTLY_COLORS[1]
        ]
        if is_discrimination:
            labels += ['DR\u00B2Y', 'DQ\u00B2Y', 'Accuracy', 'ROC AUC']
            colors += [
                DEFAULT_PLOTLY_COLORS[0], DEFAULT_PLOTLY_COLORS[1],
                DEFAULT_PLOTLY_COLORS[1], DEFAULT_PLOTLY_COLORS[1]
            ]
        with h5py.File(self.results_filename, 'r') as file:
            values = [
                file[group_key].attrs['r_squared_Y'],
                file[group_key].attrs['r_squared_X'],
                file[group_key].attrs['q_squared']
            ]
            if is_discrimination:
                values += [
                    file[group_key].attrs['discriminant_r_squared'],
                    file[group_key].attrs['discriminant_q_squared'],
                    file[group_key].attrs['accuracy'],
                    file[group_key].attrs['roc_auc']
                ]

        axis_line_style = {
            'zerolinecolor': '#375A7F',  # darkly primary
            'gridcolor': '#444444'  # darkly secondary
        } if theme == 'plotly_dark' else {
            'zerolinecolor': '#2C3E50',  # flatly primary
            'gridcolor': '#95A5A6'  # flatly secondary
        }

        metric_plot = go.Figure(data=go.Bar(x=labels,
                                            y=values,
                                            marker_color=colors),
                                layout=go.Layout(
                                    height=700,
                                    template=theme,
                                    font={'size': 16},
                                    plot_bgcolor='rgba(0,0,0,0)',
                                    paper_bgcolor='rgba(0,0,0,0)',
                                    title=f'Quality Metrics ({description})',
                                    xaxis={
                                        'title': 'Metric',
                                        **axis_line_style
                                    },
                                    yaxis={
                                        'title': 'Value',
                                        'range': [0, 1],
                                        **axis_line_style
                                    }))

        with h5py.File(self.results_filename, 'r') as file:
            t = np.array(file[group_key]['pls']['x_scores'])
            t_ortho = np.array(file[group_key]['opls']['T_ortho'][:, 0])
            target = np.ravel(np.array(file[group_key]['target']))
            if np.issubdtype(target.dtype, np.object_):
                target = target.astype(str)
            if type_of_target(np.ravel(target)).startswith('binary'):
                target = target.astype(str)

        if type_of_target(target).startswith('binary'):
            score_plot_data = [
                go.Scatter(x=np.ravel(t[np.where(target == val)]),
                           y=np.ravel(t_ortho[np.where(target == val)]),
                           mode='markers',
                           name=val,
                           marker={
                               'size': 15,
                               'opacity': 0.5,
                               'line': {
                                   'width': 0.5,
                                   'color': 'white'
                               },
                               'color': color
                           }) for val, color in zip(
                               np.unique(target).tolist(),
                               DEFAULT_PLOTLY_COLORS[:target.size])
            ]
        else:
            score_plot_data = go.Scatter(x=t.tolist(),
                                         y=t_ortho.tolist(),
                                         mode='markers',
                                         name=description,
                                         marker={
                                             'size': 15,
                                             'opacity': 0.5,
                                             'line': {
                                                 'width': 0.5,
                                                 'color': 'white'
                                             },
                                             'color': target.tolist()
                                         })
        scores_plot = go.Figure(data=score_plot_data,
                                layout=go.Layout(
                                    height=700,
                                    template=theme,
                                    font={'size': 16},
                                    plot_bgcolor='rgba(0,0,0,0)',
                                    paper_bgcolor='rgba(0,0,0,0)',
                                    title=f'Scores ({description})',
                                    xaxis={
                                        'title': 't',
                                        **axis_line_style
                                    },
                                    yaxis={
                                        'title': 't_ortho',
                                        **axis_line_style
                                    }))
        if wrap:
            return html.Div([
                dbc.Row(dcc.Graph(figure=metric_plot)),
                dbc.Row(dcc.Graph(figure=scores_plot)),
                html.Br()
            ])
        else:
            return [
                dcc.Graph(figure=metric_plot),
                dcc.Graph(figure=scores_plot)
            ]