Created
November 27, 2020 03:27
-
-
Save ThiagoFPMR/787fcffaae16d6c209b21c9dda8141d5 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 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 and Doing any Transformations Required by The Figures | |
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