<jupyter_start><jupyter_text>SeabornSeaborn is a library for making attractive and informative statistical graphics in Python. It is built on top of matplotlib. It provides a high-level interface to draw statistical graphics.To get started with seaborn, you’re going to need to install it in the terminal with either ** pip install seaborn ** or ** conda install seaborn **. Then simply include import seaborn as sns at the top of your python file.<jupyter_code>import warnings
warnings.filterwarnings('ignore')<jupyter_output><empty_output><jupyter_text>Special features1)Several built-in themes for styling matplotlib graphics 2)Tools for choosing color palettes to make beautiful plots that reveal patterns in your data3)Functions for visualizing univariate and bivariate distributions or for comparing them between subsets of data      Loading data to construct seaborn plots<jupyter_code>import seaborn as sns
import matplotlib.pyplot as plt

# Load iris data
iris = sns.load_dataset("iris")

# Construct iris plot
sns.barplot(x="species", y="petal_length", data=iris)

# Show plot
plt.show()<jupyter_output><empty_output><jupyter_text>Visualizing pairwise relationships in a datasetTo plot multiple pairwise bivariate distributions in a dataset, you can use the pairplot() function. This creates a matrix of axes and shows the relationship for each pair of columns in a DataFrame. by default, it also draws the univariate distribution of each variable on the diagonal Axes:<jupyter_code>sns.pairplot(iris)
plt.show()<jupyter_output><empty_output><jupyter_text>Seaborn themes The default theme is darkgrid. Here we change the theme to whitegrid<jupyter_code># Set theme
sns.set_style('whitegrid')
 
# Violin plot
sns.boxplot(x='species', y='petal_length', data=iris)

plt.show()<jupyter_output><empty_output><jupyter_text>Colour palette for SeabornSeaborn has some nice built-in color palette features. It also allows us to set custom color palettes. We can simply create an ordered Python list of color hex values.<jupyter_code># global config settings to control things like style, font size, color palette etc.
sns.set(context="notebook", style="darkgrid", palette="dark")
# seaborn has some nice built-in color palette features
sns.palplot(sns.color_palette())
plt.show()


# Custom palettes
type_colors = ['#78C850',  
               '#F08030',  
                '#6890F0', 
                '#A8B820',  
                '#A8A878',  
                '#A040A0', 
                '#F8D030', 
                    
                   ]
sns.boxplot(x='species', y='petal_length', data=iris, 
               palette=type_colors) # Set color palette
plt.show()<jupyter_output><empty_output><jupyter_text>What all can seaborn do ?  FacetGridIt shows bivariate scatterplots and also specifies which species each plant belongs to<jupyter_code>sns.FacetGrid(iris, hue="species",size=6) \
   .map(plt.scatter, "sepal_length", "sepal_width") \
   .add_legend()

plt.show()<jupyter_output><empty_output><jupyter_text>BoxplotWe can look at an individual feature in Seaborn through a boxplot.<jupyter_code>sns.boxplot(x="species", y="sepal_length", data=iris)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0848731600375822, 'fraction_numerical': 0.01096147823363608, 'mean_word_length': 4.703571428571428, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '461373', 'license': 'MIT', 'n_tokens_mistral': 1023, 'n_tokens_neox': 953, 'n_words': 318, 'path': 'resources/hands-on-session/Session 2 - Data Visualisation/seaborn/Seaborn.ipynb', 'repo_name': 'IEEE-NITK/BlogAdmin', 'size': '3193'}