# -*- coding: utf-8 -*-
"""Copy of EstudoCaso-Plotly-Dashboard

Automatically generated by Colaboratory.

For install packages:
 - pip install plotly plotly.express
"""


import numpy as np
import plotly.express as px
import plotly.io as pio
pio.templates

px.data.carshare()
px.data.gapminder()
df = px.data.gapminder()


"Nesse gráfico apresentamos a distribuição dos países e sua renda per capita"
px.line(df, x="country", y="gdpPercap")


px.bar(df, x="continent", y="pop", hover_name="country", color="continent")


px.bar(df.query("country == 'Brazil' "), x="year", y="pop",
       hover_name="country", color="lifeExp")


px.sunburst(df, values="pop", path=["continent", "country"],
            hover_name="country", color="lifeExp", height=700)


px.treemap(df, values='lifeExp', path=['continent', 'country'],
           color="country", height=700)


px.treemap(df, path=['continent', 'country'], values='pop',
           color='lifeExp', hover_data=['iso_alpha'],
           color_continuous_scale='RdBu',
           color_continuous_midpoint=np.average(df['lifeExp'],
           weights=df['pop']))


px.choropleth(df, locations="iso_alpha", hover_name="country",
              color="lifeExp", height=600)


px.choropleth(df, locations="iso_alpha", hover_name="lifeExp",
              color="continent", height=600)


px.choropleth(df, locations="iso_alpha", hover_data=df.columns,
              color="lifeExp", projection="natural earth", height=600)


px.scatter(df, x="gdpPercap", y="lifeExp", color="continent",
           hover_data=df.columns, height=700)


px.scatter(df, x="gdpPercap", y="lifeExp", color="continent",
           size="pop", size_max=65, hover_data=df.columns, height=700)


px.scatter(df, x="gdpPercap", y="lifeExp", color="continent", size="pop",
           size_max=75, log_x=True, hover_data=df.columns, height=700)


px.scatter(df, x="gdpPercap", y="lifeExp", color="continent", size="pop",
           facet_col="year", facet_col_wrap=5,
           log_x=True, hover_data=df.columns, height=700)


px.scatter(df, x="gdpPercap", y="lifeExp", color="continent",
           size="pop", animation_frame="year", animation_group="country",
           range_y=[20, 100], size_max=75, log_x=True,
           hover_data=df.columns, height=500)


px.scatter(df, x="gdpPercap", y="lifeExp", color="continent",
           size="pop", animation_frame="year", animation_group="country",
           range_y=[20, 100], size_max=75, log_x=True, hover_data=df.columns,
           height=500, labels=dict(gdpPercap="GDP Per Capita",
                                   lifeExp="Life Expectency"),
           template='plotly_dark')

# -*- coding: utf-8 -*-
"""Copy of EstudoCaso-Plotly-Dashboard

Automatically generated by Colaboratory.

For install packages:
 - pip install plotly plotly.express
"""


import numpy as np
import plotly.express as px
import plotly.io as pio
pio.templates

px.data.carshare()
px.data.gapminder()
df = px.data.gapminder()


"Nesse gráfico apresentamos a distribuição dos países e sua renda per capita"
px.line(df, x="country", y="gdpPercap")


px.bar(df, x="continent", y="pop", hover_name="country", color="continent")


px.bar(df.query("country == 'Brazil' "), x="year", y="pop",
       hover_name="country", color="lifeExp")


px.sunburst(df, values="pop", path=["continent", "country"],
            hover_name="country", color="lifeExp", height=700)


px.treemap(df, values='lifeExp', path=['continent', 'country'],
           color="country", height=700)


px.treemap(df, path=['continent', 'country'], values='pop',
           color='lifeExp', hover_data=['iso_alpha'],
           color_continuous_scale='RdBu',
           color_continuous_midpoint=np.average(df['lifeExp'],
           weights=df['pop']))


px.choropleth(df, locations="iso_alpha", hover_name="country",
              color="lifeExp", height=600)


px.choropleth(df, locations="iso_alpha", hover_name="lifeExp",
              color="continent", height=600)


px.choropleth(df, locations="iso_alpha", hover_data=df.columns,
              color="lifeExp", projection="natural earth", height=600)


px.scatter(df, x="gdpPercap", y="lifeExp", color="continent",
           hover_data=df.columns, height=700)


px.scatter(df, x="gdpPercap", y="lifeExp", color="continent",
           size="pop", size_max=65, hover_data=df.columns, height=700)


px.scatter(df, x="gdpPercap", y="lifeExp", color="continent", size="pop",
           size_max=75, log_x=True, hover_data=df.columns, height=700)


px.scatter(df, x="gdpPercap", y="lifeExp", color="continent", size="pop",
           facet_col="year", facet_col_wrap=5,
           log_x=True, hover_data=df.columns, height=700)


px.scatter(df, x="gdpPercap", y="lifeExp", color="continent",
           size="pop", animation_frame="year", animation_group="country",
           range_y=[20, 100], size_max=75, log_x=True,
           hover_data=df.columns, height=500)


px.scatter(df, x="gdpPercap", y="lifeExp", color="continent",
           size="pop", animation_frame="year", animation_group="country",
           range_y=[20, 100], size_max=75, log_x=True, hover_data=df.columns,
           height=500, labels=dict(gdpPercap="GDP Per Capita",
                                   lifeExp="Life Expectency"),
           template='plotly_dark')

# -*- coding: utf-8 -*- Copy of EstudoCaso-Plotly-Dashboard  Automatically generated by Colaboratory.  For install packages:  - pip install plotly plotly.express