import seaborn as sns
import matplotlib.pyplot as plt
crashes = sns.load_dataset("car_crashes")
sns.set(rc={'figure.figsize':(11.7,8.27)})
sns.barplot(x = 'speeding', y = 'abbrev', data = crashes);
import plotly_express as px
px.bar(data_frame = crashes, x = 'speeding', y = 'abbrev', color = 'abbrev', orientation= "h")
plotly.py
Seaborn
and ggplot2
(R)# !! pip3 install plotly_express # Python3
import plotly_express as px
gapminder = px.data.gapminder()
gapminder.tail(4)
px.bar(data_frame= gapminder[gapminder.year==2007], x = 'country', y = 'pop')
px.histogram(data_frame= gapminder, x = 'pop')
px.box(data_frame= gapminder, y = 'lifeExp')
px.box(data_frame= gapminder, y = 'lifeExp', color = 'continent')
px.violin(data_frame= gapminder, y = 'lifeExp', color = 'continent', box=True)
px.line(gapminder.query("country == ['India','China','United States']"), 'year','pop', color = 'country')
px.scatter(data_frame= gapminder, x = 'gdpPercap', y = 'lifeExp')
px.scatter(data_frame= gapminder, x = 'gdpPercap', y = 'lifeExp', marginal_y='box', marginal_x='histogram')
px.scatter(data_frame= gapminder, x = 'gdpPercap', y = 'lifeExp', trendline='ols')
px.scatter(data_frame= gapminder, x = 'gdpPercap', y = 'lifeExp', hover_name = 'country', trendline= 'ols')
px.scatter(data_frame= gapminder, x = 'gdpPercap', y = 'lifeExp', hover_name = 'country', color = 'country', log_x=True)
gapminder7 = gapminder[gapminder.year==2007]
px.scatter(data_frame= gapminder7, x = 'gdpPercap', y = 'lifeExp', hover_name = 'country',
log_x=True)
px.scatter(data_frame= gapminder7, x = 'gdpPercap', y = 'lifeExp', hover_name = 'country',
log_x=True, facet_col="continent", trendline = 'ols')
px.scatter(data_frame= gapminder7, x = 'gdpPercap', y = 'lifeExp', hover_name = 'country',
log_x=True, #facet_col="continent",
color = 'continent', size = 'pop')
px.scatter(data_frame= gapminder7, x = 'gdpPercap', y = 'lifeExp', hover_name = 'country',
log_x=True, facet_col="continent",
color = 'continent', size = 'pop')
px.scatter(data_frame= gapminder7, x = 'gdpPercap', y = 'lifeExp', hover_name = 'country', color = 'country')
px.scatter(data_frame= gapminder7, x = 'gdpPercap', y = 'lifeExp', hover_name = 'country', color = 'country',
size = 'pop')
px.scatter(px.data.gapminder(), x="gdpPercap", y="lifeExp", animation_frame="year", animation_group="country",
size="pop", color="country", hover_name="country",
log_x = True,
size_max=45, range_x=[100,100000], range_y=[25,90])