python sns boxplot code example
Example 1: seaborn orient
>>> import seaborn as sns
>>> sns.set_theme(style="whitegrid")
>>> tips = sns.load_dataset("tips")
>>> ax = sns.boxplot(x=tips["total_bill"])
Example 2: python how to make boxplots with pandas and seaborn
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
data_url = 'http://bit.ly/2cLzoxH'
gapminder = pd.read_csv(data_url)
print(gapminder.head(3))
gapminder_2007 = gapminder[gapminder['year']==2007]
gapminder_2007.head(3)
bplot = sns.boxplot(y='lifeExp', x='continent',
data=gapminder_2007,
width=0.5,
palette="colorblind")
bplot = sns.boxplot(y='lifeExp', x='continent',
data=gapminder_2007,
width=0.5,
palette="colorblind")
bplot = sns.stripplot(y='lifeExp', x='continent',
data=gapminder_2007,
jitter=True,
marker='o',
alpha=0.5,
color='black')
bplot = sns.boxplot(y='lifeExp', x='continent',
data=gapminder_2007,
width=0.5,
palette="colorblind")
bplot = sns.swarmplot(y='lifeExp', x='continent',
data=gapminder_2007,
color='black',
alpha=0.75)