Created
March 6, 2020 14:22
-
-
Save mashhadazam/b7bd879e76f88c762f2b1bc60b65ebd2 to your computer and use it in GitHub Desktop.
This file contains 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
def plotcountry(Country): | |
fig = make_subplots(rows=3, cols=2,shared_xaxes=True, | |
specs=[[{}, {}],[{},{}], | |
[{"colspan": 2}, None]], | |
subplot_titles=('Total Confirmed Cases','Active Cases','Deaths','Recoveries','Death to Cases Ratio')) | |
fig.add_trace(go.Scatter(x=CountryConsolidated.loc[Country].index,y=CountryConsolidated.loc[Country,'Total Confirmed Cases'], | |
mode='lines+markers', | |
name='Confirmed Cases', | |
line=dict(color=chartcol,width=2)), | |
row=1,col=1) | |
fig.add_trace(go.Scatter(x=CountryConsolidated.loc[Country].index,y=CountryConsolidated.loc[Country,'Active Cases'], | |
mode='lines+markers', | |
name='Active Cases', | |
line=dict(color=chartcol,width=2)), | |
row=1,col=2) | |
fig.add_trace(go.Scatter(x=CountryConsolidated.loc[Country].index,y=CountryConsolidated.loc[Country,'Total Deaths'], | |
mode='lines+markers', | |
name='Total Deaths', | |
line=dict(color=chartcol,width=2)), | |
row=2,col=1) | |
fig.add_trace(go.Scatter(x=CountryConsolidated.loc[Country].index,y=CountryConsolidated.loc[Country,'Total Recoveries'], | |
mode='lines+markers', | |
name='Total Recoveries', | |
line=dict(color=chartcol,width=2)), | |
row=2,col=2) | |
fig.add_trace(go.Scatter(x=CountryConsolidated.loc[Country].index,y=CountryConsolidated.loc[Country,'Death to Cases Ratio'], | |
mode='lines+markers', | |
name='Death to Cases Ratio', | |
line=dict(color=chartcol,width=2)), | |
row=3,col=1) | |
fig.update_layout(showlegend=False) | |
return fig | |
CountriesList=['Germany','Mainland China','US','Italy','France','Pakistan','South Korea','Japan','Singapore'] | |
interact(plotcountry, Country=widgets.Dropdown(options=CountriesList)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment