Difference makes the DIFFERENCE
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(color_codes = True)
pen = sns.load_dataset('penguins')
pen.head(2)
sns.violinplot(x='island', y = 'flipper_length_mm', data = pen[pen.sex=='Male'])
sns.violinplot(x='island', y = 'flipper_length_mm', data = pen[pen.sex=='Female'])
sns.violinplot(x='island', y = 'flipper_length_mm',
split=True, hue = 'sex', data = pen)
sns.violinplot(x='island', y = 'flipper_length_mm',
split=True, hue = 'island', data = pen)
sns.violinplot(x='island', y = 'flipper_length_mm',
split=True, inner = 'quartile', hue = 'sex', data = pen)
sns.violinplot(x='island', y = 'flipper_length_mm', hue = 'species', data = pen)
pen['bin_species'] = pen.species.apply(lambda x: 0 if x == "Gentoo" else 1)
pen.head(2)
sns.violinplot(x = 'island', y='flipper_length_mm',
split = True, inner = 'quartile', hue='bin_species', data = pen)
pen['bin_species'] = pen.species.apply(lambda x: "Gentoo" if x == "Gentoo" else 'Adelie | Chinstrap')
pen.head(2)
sns.violinplot(x = 'island', y='flipper_length_mm',
split = True, inner = 'quartile', hue='bin_species', data = pen)