<jupyter_start><jupyter_text>Grids<jupyter_code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_csv('Data/StudentsPerformance.csv')
df.head()<jupyter_output><empty_output><jupyter_text>Catplot() - categorical plotCatplot is `very base level call` and allows us to use `any categorical plot`. Catplot allows us to use `FacetGrid` on top of which kind of plot.**NOTE: use catplot() only if you want to use row, col. Otherwise, use highlevel abstractions such as sns.violinplot() directly for easier understanding.**Kind Options are: - “point"- “bar”, - “strip”- “swarm”- “box”- “violin”- “boxen”<jupyter_code># in this case, we are using catplot to draw boxplot
sns.catplot(data=df, x='gender', y='math score', kind='box')<jupyter_output><empty_output><jupyter_text>row='feature-name'- row is like using `hue`. but display on the different row.<jupyter_code>sns.catplot(data=df, x='gender', y='math score', kind='box', row='lunch')<jupyter_output><empty_output><jupyter_text>As we can see `row` parameter does the similar thing as `hue`, but displays on different row as it supposed to.<jupyter_code>sns.catplot(data=df, x='gender', y='math score', kind='box', hue='lunch')<jupyter_output><empty_output><jupyter_text>col = 'feature-name'- similar to row and display on different columns.<jupyter_code>sns.catplot(data=df, x='gender', y='math score', kind='box', col='lunch')<jupyter_output><empty_output><jupyter_text>row + col<jupyter_code>sns.catplot(data=df, x='gender', y='math score', kind='box', col='lunch', row='test preparation course')
sns.catplot(data=df, x='gender', y='math score', kind='violin')<jupyter_output><empty_output><jupyter_text>--------  PairGrid- parigrid is the behind the scence of `pairplot`, which allows us to use `grid system`<jupyter_code>sns.PairGrid(df)
g = sns.PairGrid(df)
g = g.map_upper(sns.scatterplot) # map scatterplot on the upper diagional
g = sns.PairGrid(df)

g = g.map_upper(sns.scatterplot)

g = g.map_diag(sns.histplot)

g = g.map_lower(sns.kdeplot)
g = sns.PairGrid(df)

g = g.map_upper(sns.scatterplot)

g = g.map_diag(sns.kdeplot)

g = g.map_lower(sns.kdeplot)
g = sns.PairGrid(df, hue='gender')

g = g.map_upper(sns.scatterplot)

g = g.map_diag(sns.kdeplot)

g = g.map_lower(sns.kdeplot)

g = g.add_legend()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14919011082693948, 'fraction_numerical': 0.0, 'mean_word_length': 6.474522292993631, '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': '306459', 'license': 'MIT', 'n_tokens_mistral': 894, 'n_tokens_neox': 880, 'n_words': 214, 'path': 'Machine Learning & Data Science Masterclass - JP/05-Seaborn/05-Seaborn-Grids.ipynb', 'repo_name': 'ptyadana/probability-and-statistics-for-business-and-data-science', 'size': '2346'}