Skip to content

Instantly share code, notes, and snippets.

@ThiagoFPMR
Last active November 27, 2020 03:30
Show Gist options
  • Save ThiagoFPMR/6b2d6e1b9e37ac5bf49d4a2d9ba23be4 to your computer and use it in GitHub Desktop.
Save ThiagoFPMR/6b2d6e1b9e37ac5bf49d4a2d9ba23be4 to your computer and use it in GitHub Desktop.
import dash
from dash.dependencies import Output, Input
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import pandas as pd
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
colors = {
'background': '#FFFFFF',
'text': '#7FDBFF'
}
# Reading The Dataset
data = pd.read_csv('https://gist.githubusercontent.com/ThiagoFPMR/' +
'fea32b8082a54889ba7470ac63252299/raw/' +
'aea145700257ffa89d924073189a0e3804bd987c/' +
'covid_worldwide.csv')
# Defining App Layout
app.layout = html.Div(style={'backgroundColor': colors['background']}, children=[
html.H1('Studying The Pandemic Worldwide', style={'textAlign':'center'}),
html.Div([
html.Div([
html.Label('Population'),
dcc.Slider(
id='population-slider',
min=data.population.min(),
max=data.population.max(),
marks={
72037 : '72K',
80000000 : '80M',
150000000 : '150M',
300000000 : '300M',
700000000 : '700M',
1000000000 : '1B',
1439323776 : '1.4B'
},
value=data.population.min(),
step=100000000,
updatemode='drag'
)
]),
html.Div([
html.Label('Interest Variable'),
dcc.Dropdown(
id='interest-variable',
options=[{'label':'Total Cases', 'value':'total_cases'},
{'label': 'Total Tests', 'value':'total_tests'},
{'label': 'Total Deaths', 'value':'total_deaths'},
{'label': 'Total Recovered', 'value':'total_recovered'}],
value='total_cases'
)
])
], style = {'width':'90%','margin':'auto'}),
html.Div([
dcc.Graph(
id='covid-vs-edu',
),
html.Div(
dcc.Graph(
id='covid-vs-income',
)
, style = {'width': '50%', 'display': 'inline-block'}),
html.Div(
dcc.Graph(
id='covid-vs-income2',
)
, style = {'width': '50%', 'display': 'inline-block'})
], style = {'width':'90%','margin':'auto'})
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment