Seaborn: Statistical Data Visualization for Python
Use Seaborn to create histograms, KDE plots, pair plots, bar plots, violin plots, regression lines, and correlation heatmaps with ease.
Seaborn is a Python visualization library built directly on top of Matplotlib, designed specifically for statistical graphics. Where Matplotlib gives you complete control at the cost of verbosity, Seaborn lets you produce elegant, informative charts in a single function call — and it integrates seamlessly with Pandas DataFrames. You pass your DataFrame and column names directly to Seaborn functions, and it handles the aggregation, styling, and statistical overlays automatically. This makes it the go-to library for exploratory data analysis in data science and machine learning workflows.
Installation and Import
pip install seaborn
import seaborn as snsimport matplotlib.pyplot as plt
Styling and Themes
One sns.set_theme() call controls the visual style of all subsequent plots.
# Apply a modern dark grid style with muted colorssns.set_theme(style="darkgrid", palette="muted")
Available styles:whitegrid, darkgrid, ticks, white, darkAvailable contexts (scale fonts and element sizes): paper, notebook, talk, poster
Analyzing Numerical Distributions
Distribution plots help you understand how a single continuous variable is spread — its range, center, skewness, and density.
Histograms with KDE (sns.histplot)
Combine a histogram with a Kernel Density Estimation (KDE) curve for a smooth probability overlay:
tips = sns.load_dataset("tips")sns.histplot(data=tips, x="total_bill", kde=True, color="teal")plt.title("Distribution of Total Bills")plt.show()
Joint Plots (sns.jointplot)
A joint plot shows the bivariate relationship between two variables (scatter or hex plot) alongside the univariate distribution of each variable on the margins:
kind options include "scatter", "hex", "kde", and "reg".
Pair Plots (sns.pairplot)
A pair plot creates a grid that compares every numerical column against every other — scatter plots off the diagonal, distributions on the diagonal. It is one of the fastest ways to get an overview of a new dataset.
# Color-code by a categorical variable using huesns.pairplot(data=tips, hue="sex", palette="coolwarm")plt.show()
Always start exploratory data analysis with sns.pairplot(). In a single call you’ll spot correlations, clusters, outliers, and skewed distributions that would take many individual plots to uncover.
Categorical Visualizations
Categorical plots compare a numerical variable across discrete groups.
Bar Plots (sns.barplot)
Seaborn’s bar plot automatically aggregates data (mean by default) and draws confidence interval error bars:
sns.barplot(data=tips, x="day", y="tip", hue="time", palette="Set2")plt.title("Average Tip by Day and Meal Time")plt.show()
Count Plots (sns.countplot)
A count plot shows the frequency of each category — equivalent to a histogram for categorical data:
sns.countplot(data=tips, x="smoker", palette="Blues")plt.title("Frequency of Customers by Smoking Status")plt.show()
Box Plots vs. Violin Plots
Both charts compare distributions across categories, but they reveal different aspects of the data:
fig, axes = plt.subplots(1, 2, figsize=(12, 5))# Box plot — quartiles and outlierssns.boxplot(data=tips, x="day", y="total_bill", ax=axes[0], palette="pastel")axes[0].set_title("Total Bill Range per Day (Box Plot)")# Violin plot — distribution density shapesns.violinplot(data=tips, x="day", y="total_bill", ax=axes[1], palette="muted")axes[1].set_title("Total Bill Density per Day (Violin Plot)")plt.tight_layout()plt.show()
Chart
Shows
Box plot
Median, quartiles (Q1/Q3), whiskers, outliers
Violin plot
All of the above + the full probability density shape
Relationship and Regression Plots
Scatter Plots (sns.scatterplot)
Map a third variable to point color (hue) and a fourth to point size (size) to pack more information into a single chart:
sns.scatterplot( data=tips, x="total_bill", y="tip", hue="smoker", size="size", sizes=(20, 200))plt.title("Bill vs. Tip — sized by Table Size")plt.show()
Regression Plots (sns.lmplot)
Draws a scatter plot overlaid with a fitted linear regression line and shaded confidence bands:
sns.lmplot(data=tips, x="total_bill", y="tip", hue="smoker", height=5)plt.title("Bill vs. Tip — Linear Regression by Smoking Status")plt.show()
sns.lmplot always creates its own figure, so you cannot pass an ax parameter. Use sns.regplot if you need to embed a regression line inside an existing subplot grid.
Correlation Heatmaps
A heatmap visualizes the correlation matrix of a DataFrame — making it easy to spot which pairs of features are strongly or weakly related.
# 1. Select only numerical columnsnumerical_df = tips.select_dtypes(include=["number"])# 2. Compute the Pearson correlation matrixcorr_matrix = numerical_df.corr()# 3. Draw the heatmapsns.heatmap( corr_matrix, annot=True, # Print correlation values inside cells cmap="coolwarm", # Red = positive, Blue = negative correlation vmin=-1, vmax=1, linewidths=0.5)plt.title("Tips Dataset Correlation Matrix")plt.show()
Correlation values range from -1 (perfect negative correlation) to +1 (perfect positive correlation). Values close to 0 indicate no linear relationship.
Correlation measures only linear relationships. A near-zero correlation doesn’t necessarily mean two variables are unrelated — they may have a non-linear relationship. Always visualize your data before drawing conclusions from correlation alone.
Seaborn Chart Quick Reference
Chart
Function
Best For
Distribution + KDE
sns.histplot(kde=True)
Single numerical variable
Scatter + margins
sns.jointplot
Two numerical variables
All pairs overview
sns.pairplot
Full dataset EDA
Category means + CI
sns.barplot
Numerical vs. categorical
Category frequency
sns.countplot
Categorical counts
Distribution ranges
sns.boxplot
Outlier-focused comparison
Distribution density
sns.violinplot
Shape-focused comparison
Scatter + regression
sns.lmplot
Trend lines between numerics
Feature correlations
sns.heatmap
Correlation matrix
{"docsConfig":{"theme":"palm","$schema":"https://mintlify.com/docs.json","name":"Python for AI \u0026 FastAPI","colors":{"primary":"#16A34A","light":"#07C983","dark":"#15803D"},"favicon":"https://mintcdn.com/fastapi2day/o2Jso_KhqkR4_ilm/favicon.svg?fit=max\u0026auto=format\u0026n=o2Jso_KhqkR4_ilm\u0026q=85\u0026s=d4ea6ac51fe137dae217309616455228","navbar":{"primary":{"type":"button","label":"Start Learning","href":"https://sgrinfo.tech"}},"footer":{},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"fastapi2day","hasAudioNarration":false,"actualSubdomain":"fastapi2day","customDomains":["fastapi2day.codewithsiva.dev"],"gitSource":{"type":"github","owner":"mintlify-community","repo":"docs-sgrinfotech-31e4544d","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6aea217d8509c0a36927aa68:success","clientVersion":"0.0.4347","searchFilterCounts":[{"language":"default","tag":"Data \u0026 APIs","count":31},{"language":"default","tag":"Python","count":24},{"language":"default","tag":"Getting Started","count":21},{"language":"default","tag":"Projects \u0026 Tools","count":19},{"language":"default","tag":"FastAPI","count":15},{"language":"default","tag":"Advanced","count":12},{"language":"default","tag":"Basics","count":7},{"language":"default","tag":"Environments \u0026 Packages","count":7},{"language":"default","tag":"VS Code","count":6},{"language":"default","tag":"Python Setup","count":6}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"data-analysis/seaborn","slug":"/data-analysis/seaborn","pageMetadata":{"title":"Seaborn: Statistical Data Visualization for Python","sidebarTitle":"Seaborn","description":"Use Seaborn to create histograms, KDE plots, pair plots, bar plots, violin plots, regression lines, and correlation heatmaps with ease.","href":"/data-analysis/seaborn"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Use Seaborn to create histograms, KDE plots, pair plots, bar plots, violin plots, regression lines, and correlation heatmaps with ease.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,Table,Tip,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Seaborn is a Python visualization library built directly on top of Matplotlib, designed specifically for statistical graphics. Where Matplotlib gives you complete control at the cost of verbosity, Seaborn lets you produce elegant, informative charts in a single function call — and it integrates seamlessly with Pandas DataFrames. You pass your DataFrame and column names directly to Seaborn functions, and it handles the aggregation, styling, and statistical overlays automatically. This makes it the go-to library for exploratory data analysis in data science and machine learning workflows.`}),`\n`,_jsx(Heading,{level:`2`,id:`installation-and-import`,children:`Installation and Import`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` seaborn`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` seaborn `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sns`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` matplotlib.pyplot `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` plt`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`styling-and-themes`,children:`Styling and Themes`}),`\n`,_jsxs(_components.p,{children:[`One `,_jsx(_components.code,{children:`sns.set_theme()`}),` call controls the visual style of all subsequent plots.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Apply a modern dark grid style with muted colors`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sns.set_theme(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`style`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"darkgrid\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`palette`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"muted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Available styles:`}),` `,_jsx(_components.code,{children:`whitegrid`}),`, `,_jsx(_components.code,{children:`darkgrid`}),`, `,_jsx(_components.code,{children:`ticks`}),`, `,_jsx(_components.code,{children:`white`}),`, `,_jsx(_components.code,{children:`dark`})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Available contexts`}),` (scale fonts and element sizes): `,_jsx(_components.code,{children:`paper`}),`, `,_jsx(_components.code,{children:`notebook`}),`, `,_jsx(_components.code,{children:`talk`}),`, `,_jsx(_components.code,{children:`poster`})]}),`\n`,_jsx(Heading,{level:`2`,id:`analyzing-numerical-distributions`,children:`Analyzing Numerical Distributions`}),`\n`,_jsx(_components.p,{children:`Distribution plots help you understand how a single continuous variable is spread — its range, center, skewness, and density.`}),`\n`,_jsxs(Heading,{level:`3`,id:`histograms-with-kde-sns-histplot`,children:[`Histograms with KDE (`,_jsx(_components.code,{children:`sns.histplot`}),`)`]}),`\n`,_jsxs(_components.p,{children:[`Combine a histogram with a `,_jsx(_components.strong,{children:`Kernel Density Estimation (KDE)`}),` curve for a smooth probability overlay:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tips `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sns.load_dataset(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tips\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sns.histplot(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tips, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`x`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"total_bill\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`kde`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`color`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"teal\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.title(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Distribution of Total Bills\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.show()`})}),`\n`]})})}),`\n`,_jsxs(Heading,{level:`3`,id:`joint-plots-sns-jointplot`,children:[`Joint Plots (`,_jsx(_components.code,{children:`sns.jointplot`}),`)`]}),`\n`,_jsxs(_components.p,{children:[`A joint plot shows the `,_jsx(_components.strong,{children:`bivariate relationship`}),` between two variables (scatter or hex plot) alongside the `,_jsx(_components.strong,{children:`univariate distribution`}),` of each variable on the margins:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sns.jointplot(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tips, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`x`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"total_bill\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`y`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tip\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`kind`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"scatter\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`color`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"purple\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.show()`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`kind`}),` options include `,_jsx(_components.code,{children:`\"scatter\"`}),`, `,_jsx(_components.code,{children:`\"hex\"`}),`, `,_jsx(_components.code,{children:`\"kde\"`}),`, and `,_jsx(_components.code,{children:`\"reg\"`}),`.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`pair-plots-sns-pairplot`,children:[`Pair Plots (`,_jsx(_components.code,{children:`sns.pairplot`}),`)`]}),`\n`,_jsxs(_components.p,{children:[`A pair plot creates a grid that compares `,_jsx(_components.strong,{children:`every numerical column against every other`}),` — scatter plots off the diagonal, distributions on the diagonal. It is one of the fastest ways to get an overview of a new dataset.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Color-code by a categorical variable using hue`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sns.pairplot(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tips, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`hue`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sex\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`palette`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"coolwarm\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.show()`})}),`\n`]})})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Always start exploratory data analysis with `,_jsx(_components.code,{children:`sns.pairplot()`}),`. In a single call you’ll spot correlations, clusters, outliers, and skewed distributions that would take many individual plots to uncover.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`categorical-visualizations`,children:`Categorical Visualizations`}),`\n`,_jsx(_components.p,{children:`Categorical plots compare a numerical variable across discrete groups.`}),`\n`,_jsxs(Heading,{level:`3`,id:`bar-plots-sns-barplot`,children:[`Bar Plots (`,_jsx(_components.code,{children:`sns.barplot`}),`)`]}),`\n`,_jsxs(_components.p,{children:[`Seaborn’s bar plot automatically aggregates data (mean by default) and draws `,_jsx(_components.strong,{children:`confidence interval error bars`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sns.barplot(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tips, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`x`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"day\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`y`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tip\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`hue`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"time\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`palette`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Set2\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.title(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Average Tip by Day and Meal Time\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.show()`})}),`\n`]})})}),`\n`,_jsxs(Heading,{level:`3`,id:`count-plots-sns-countplot`,children:[`Count Plots (`,_jsx(_components.code,{children:`sns.countplot`}),`)`]}),`\n`,_jsx(_components.p,{children:`A count plot shows the frequency of each category — equivalent to a histogram for categorical data:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sns.countplot(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tips, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`x`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"smoker\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`palette`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Blues\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.title(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Frequency of Customers by Smoking Status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.show()`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`box-plots-vs-violin-plots`,children:`Box Plots vs. Violin Plots`}),`\n`,_jsx(_components.p,{children:`Both charts compare distributions across categories, but they reveal different aspects of the data:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`fig, axes `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` plt.subplots(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`figsize`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`12`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Box plot — quartiles and outliers`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sns.boxplot(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tips, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`x`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"day\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`y`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"total_bill\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ax`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`axes[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`palette`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"pastel\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`axes[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].set_title(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Total Bill Range per Day (Box Plot)\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Violin plot — distribution density shape`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sns.violinplot(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tips, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`x`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"day\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`y`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"total_bill\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ax`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`axes[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`palette`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"muted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`axes[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].set_title(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Total Bill Density per Day (Violin Plot)\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.tight_layout()`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.show()`})}),`\n`]})})}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Chart`}),_jsx(_components.th,{children:`Shows`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Box plot`}),_jsx(_components.td,{children:`Median, quartiles (Q1/Q3), whiskers, outliers`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Violin plot`}),_jsx(_components.td,{children:`All of the above + the full probability density shape`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`relationship-and-regression-plots`,children:`Relationship and Regression Plots`}),`\n`,_jsxs(Heading,{level:`3`,id:`scatter-plots-sns-scatterplot`,children:[`Scatter Plots (`,_jsx(_components.code,{children:`sns.scatterplot`}),`)`]}),`\n`,_jsxs(_components.p,{children:[`Map a third variable to point color (`,_jsx(_components.code,{children:`hue`}),`) and a fourth to point size (`,_jsx(_components.code,{children:`size`}),`) to pack more information into a single chart:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sns.scatterplot(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tips,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` x`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"total_bill\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` y`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tip\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` hue`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"smoker\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"size\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` sizes`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`20`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`200`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.title(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Bill vs. Tip — sized by Table Size\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.show()`})}),`\n`]})})}),`\n`,_jsxs(Heading,{level:`3`,id:`regression-plots-sns-lmplot`,children:[`Regression Plots (`,_jsx(_components.code,{children:`sns.lmplot`}),`)`]}),`\n`,_jsxs(_components.p,{children:[`Draws a scatter plot overlaid with a `,_jsx(_components.strong,{children:`fitted linear regression line`}),` and shaded confidence bands:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sns.lmplot(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tips, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`x`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"total_bill\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`y`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tip\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`hue`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"smoker\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`height`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.title(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Bill vs. Tip — Linear Regression by Smoking Status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.show()`})}),`\n`]})})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`sns.lmplot`}),` always creates its own figure, so you cannot pass an `,_jsx(_components.code,{children:`ax`}),` parameter. Use `,_jsx(_components.code,{children:`sns.regplot`}),` if you need to embed a regression line inside an existing subplot grid.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`correlation-heatmaps`,children:`Correlation Heatmaps`}),`\n`,_jsx(_components.p,{children:`A heatmap visualizes the correlation matrix of a DataFrame — making it easy to spot which pairs of features are strongly or weakly related.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`17`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`17`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 1. Select only numerical columns`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`numerical_df `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tips.select_dtypes(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`include`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"number\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 2. Compute the Pearson correlation matrix`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`corr_matrix `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` numerical_df.corr()`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 3. Draw the heatmap`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sns.heatmap(`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` corr_matrix,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` annot`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Print correlation values inside cells`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` cmap`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"coolwarm\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Red = positive, Blue = negative correlation`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` vmin`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=-`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` vmax`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` linewidths`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.5`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.title(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Tips Dataset Correlation Matrix\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.show()`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Correlation values range from `,_jsx(_components.strong,{children:`-1`}),` (perfect negative correlation) to `,_jsx(_components.strong,{children:`+1`}),` (perfect positive correlation). Values close to `,_jsx(_components.strong,{children:`0`}),` indicate no linear relationship.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Correlation measures only `,_jsx(_components.strong,{children:`linear`}),` relationships. A near-zero correlation doesn’t necessarily mean two variables are unrelated — they may have a non-linear relationship. Always visualize your data before drawing conclusions from correlation alone.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`seaborn-chart-quick-reference`,children:`Seaborn Chart Quick Reference`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Chart`}),_jsx(_components.th,{children:`Function`}),_jsx(_components.th,{children:`Best For`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Distribution + KDE`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`sns.histplot(kde=True)`})}),_jsx(_components.td,{children:`Single numerical variable`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Scatter + margins`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`sns.jointplot`})}),_jsx(_components.td,{children:`Two numerical variables`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`All pairs overview`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`sns.pairplot`})}),_jsx(_components.td,{children:`Full dataset EDA`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Category means + CI`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`sns.barplot`})}),_jsx(_components.td,{children:`Numerical vs. categorical`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Category frequency`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`sns.countplot`})}),_jsx(_components.td,{children:`Categorical counts`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Distribution ranges`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`sns.boxplot`})}),_jsx(_components.td,{children:`Outlier-focused comparison`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Distribution density`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`sns.violinplot`})}),_jsx(_components.td,{children:`Shape-focused comparison`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Scatter + regression`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`sns.lmplot`})}),_jsx(_components.td,{children:`Trend lines between numerics`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Feature correlations`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`sns.heatmap`})}),_jsx(_components.td,{children:`Correlation matrix`})]})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Seaborn: Statistical Data Visualization for Python","sidebarTitle":"Seaborn","description":"Use Seaborn to create histograms, KDE plots, pair plots, bar plots, violin plots, regression lines, and correlation heatmaps with ease.","href":"/data-analysis/seaborn"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Installation and Import","slug":"installation-and-import","depth":2,"children":[]},{"title":"Styling and Themes","slug":"styling-and-themes","depth":2,"children":[]},{"title":"Analyzing Numerical Distributions","slug":"analyzing-numerical-distributions","depth":2,"children":[{"title":"Histograms with KDE (sns.histplot)","slug":"histograms-with-kde-sns-histplot","depth":3,"children":[]},{"title":"Joint Plots (sns.jointplot)","slug":"joint-plots-sns-jointplot","depth":3,"children":[]},{"title":"Pair Plots (sns.pairplot)","slug":"pair-plots-sns-pairplot","depth":3,"children":[]}]},{"title":"Categorical Visualizations","slug":"categorical-visualizations","depth":2,"children":[{"title":"Bar Plots (sns.barplot)","slug":"bar-plots-sns-barplot","depth":3,"children":[]},{"title":"Count Plots (sns.countplot)","slug":"count-plots-sns-countplot","depth":3,"children":[]},{"title":"Box Plots vs. Violin Plots","slug":"box-plots-vs-violin-plots","depth":3,"children":[]}]},{"title":"Relationship and Regression Plots","slug":"relationship-and-regression-plots","depth":2,"children":[{"title":"Scatter Plots (sns.scatterplot)","slug":"scatter-plots-sns-scatterplot","depth":3,"children":[]},{"title":"Regression Plots (sns.lmplot)","slug":"regression-plots-sns-lmplot","depth":3,"children":[]}]},{"title":"Correlation Heatmaps","slug":"correlation-heatmaps","depth":2,"children":[]},{"title":"Seaborn Chart Quick Reference","slug":"seaborn-chart-quick-reference","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"fastapi2day","siteName":"Python for AI \u0026 FastAPI","title":"Seaborn: Statistical Data Visualization for Python - Python for AI \u0026 FastAPI","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-03T17:36:36.538Z","originalFileLocation":"data-analysis/seaborn.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Use Seaborn to create histograms, KDE plots, pair plots, bar plots, violin plots, regression lines, and correlation heatmaps with ease.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Python for AI \u0026amp; FastAPI\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/svg+xml\" sizes=\"180x180\" href=\"https://mintcdn.com/fastapi2day/o2Jso_KhqkR4_ilm/favicon.svg?fit=max\u0026amp;auto=format\u0026amp;n=o2Jso_KhqkR4_ilm\u0026amp;q=85\u0026amp;s=d4ea6ac51fe137dae217309616455228\">\u003clink data-mint-head rel=\"icon\" type=\"image/svg+xml\" sizes=\"32x32\" href=\"https://mintcdn.com/fastapi2day/o2Jso_KhqkR4_ilm/favicon.svg?fit=max\u0026amp;auto=format\u0026amp;n=o2Jso_KhqkR4_ilm\u0026amp;q=85\u0026amp;s=d4ea6ac51fe137dae217309616455228\">\u003clink data-mint-head rel=\"icon\" type=\"image/svg+xml\" sizes=\"16x16\" href=\"https://mintcdn.com/fastapi2day/o2Jso_KhqkR4_ilm/favicon.svg?fit=max\u0026amp;auto=format\u0026amp;n=o2Jso_KhqkR4_ilm\u0026amp;q=85\u0026amp;s=d4ea6ac51fe137dae217309616455228\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/svg+xml\" href=\"https://mintcdn.com/fastapi2day/o2Jso_KhqkR4_ilm/favicon.svg?fit=max\u0026amp;auto=format\u0026amp;n=o2Jso_KhqkR4_ilm\u0026amp;q=85\u0026amp;s=d4ea6ac51fe137dae217309616455228\">\u003cmeta data-mint-head property=\"og:title\" content=\"Seaborn: Statistical Data Visualization for Python - Python for AI \u0026amp; FastAPI\">\u003cmeta data-mint-head property=\"og:description\" content=\"Use Seaborn to create histograms, KDE plots, pair plots, bar plots, violin plots, regression lines, and correlation heatmaps with ease.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Python for AI \u0026amp; FastAPI\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://fastapi2day.codewithsiva.dev/data-analysis/seaborn\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://fastapi2day.mintlify.site/_mintlify/api/og/v2?division=Data+Analysis\u0026amp;title=Seaborn%3A+Statistical+Data+Visualization+for+Python\u0026amp;description=Use+Seaborn+to+create+histograms%2C+KDE+plots%2C+pair+plots%2C+bar+plots%2C+violin+plots%2C+regression+lines%2C+and+correlation+heatmaps+with+ease.\u0026amp;theme=be394bdd824f66fd2549706a\u0026amp;signature=d70d9aa0287eff90e13e4b61c21c5db5cd72631d0862bd6d01942ef8099c446b\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Seaborn: Statistical Data Visualization for Python - Python for AI \u0026amp; FastAPI\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Use Seaborn to create histograms, KDE plots, pair plots, bar plots, violin plots, regression lines, and correlation heatmaps with ease.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://fastapi2day.mintlify.site/_mintlify/api/og/v2?division=Data+Analysis\u0026amp;title=Seaborn%3A+Statistical+Data+Visualization+for+Python\u0026amp;description=Use+Seaborn+to+create+histograms%2C+KDE+plots%2C+pair+plots%2C+bar+plots%2C+violin+plots%2C+regression+lines%2C+and+correlation+heatmaps+with+ease.\u0026amp;theme=be394bdd824f66fd2549706a\u0026amp;signature=d70d9aa0287eff90e13e4b61c21c5db5cd72631d0862bd6d01942ef8099c446b\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"https://mintlify.s3.us-west-1.amazonaws.com/fastapi2day/_generated/favicon/browserconfig.xml?v=3\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Python for AI \u0026amp; FastAPI\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#16A34A\">\u003clink data-mint-head rel=\"canonical\" href=\"https://fastapi2day.codewithsiva.dev/data-analysis/seaborn\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/data-analysis/seaborn.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://fastapi2day.codewithsiva.dev/#organization\",\"name\":\"Python for AI \u0026 FastAPI\",\"url\":\"https://fastapi2day.codewithsiva.dev\"},{\"@type\":\"WebSite\",\"@id\":\"https://fastapi2day.codewithsiva.dev#website\",\"name\":\"Python for AI \u0026 FastAPI\",\"url\":\"https://fastapi2day.codewithsiva.dev\",\"publisher\":{\"@id\":\"https://fastapi2day.codewithsiva.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://fastapi2day.codewithsiva.dev/data-analysis/seaborn#webpage\",\"url\":\"https://fastapi2day.codewithsiva.dev/data-analysis/seaborn\",\"name\":\"Seaborn: Statistical Data Visualization for Python\",\"description\":\"Use Seaborn to create histograms, KDE plots, pair plots, bar plots, violin plots, regression lines, and correlation heatmaps with ease.\",\"dateModified\":\"2026-08-03T17:36:36.538Z\",\"isPartOf\":{\"@id\":\"https://fastapi2day.codewithsiva.dev#website\"},\"breadcrumb\":{\"@id\":\"https://fastapi2day.codewithsiva.dev/data-analysis/seaborn#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://fastapi2day.codewithsiva.dev/data-analysis/seaborn#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Data Analysis\",\"item\":\"https://fastapi2day.codewithsiva.dev/data-analysis/numpy\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Seaborn: Statistical Data Visualization for Python\",\"item\":\"https://fastapi2day.codewithsiva.dev/data-analysis/seaborn\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://fastapi2day.codewithsiva.dev/data-analysis/seaborn#article\",\"headline\":\"Seaborn: Statistical Data Visualization for Python\",\"name\":\"Seaborn: Statistical Data Visualization for Python\",\"description\":\"Use Seaborn to create histograms, KDE plots, pair plots, bar plots, violin plots, regression lines, and correlation heatmaps with ease.\",\"url\":\"https://fastapi2day.codewithsiva.dev/data-analysis/seaborn\",\"mainEntityOfPage\":{\"@id\":\"https://fastapi2day.codewithsiva.dev/data-analysis/seaborn#webpage\"},\"dateModified\":\"2026-08-03T17:36:36.538Z\",\"publisher\":{\"@id\":\"https://fastapi2day.codewithsiva.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://fastapi2day.codewithsiva.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Python for AI \u0026 FastAPI\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Python for AI \u0026 FastAPI\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/data-analysis/seaborn.md","siteName":"Python for AI \u0026 FastAPI","nav":{"global":null,"tabs":[{"tab":"Introduction","pages":[{"title":"Introduction","href":""}]},{"tab":"Getting Started","pages":[{"title":"Getting Started","href":"/getting-started"}]},{"tab":"Python","pages":[{"title":"Python","href":"/basic-python/python-basics"}]},{"tab":"Projects \u0026 Tools","pages":[{"title":"Projects \u0026 Tools","href":"/tools"}]},{"tab":"Data \u0026 APIs","groups":[{"group":"SQL \u0026 Databases","pages":[{"title":"Introduction to Databases, DBMS \u0026 SQL Fundamentals","sidebarTitle":"Introduction","href":"/sql/intro"},{"title":"SQLite, DDL \u0026 DML: Define and Manipulate Your Data","sidebarTitle":"DDL \u0026 DML","href":"/sql/sqlite-ddl-dml"},{"title":"Setting Up Your SQLite Practice Database in VS Code","sidebarTitle":"DB Setup","href":"/sql/sqlite-dbsetup"},{"title":"DQL: Querying and Analyzing Your Data with SQL SELECT","sidebarTitle":"Querying","href":"/sql/dql"},{"title":"SQL Joins: Combining Data Across Relational Tables","sidebarTitle":"Joins","href":"/sql/joins"},{"title":"Advanced SQL: Normalization, ACID, and Window Functions","sidebarTitle":"Advanced SQL","href":"/sql/adv-sql"}]},{"group":"Data Analysis","pages":[{"title":"NumPy: Numerical Computing Foundations for Data Science","sidebarTitle":"NumPy","href":"/data-analysis/numpy"},{"title":"Pandas: Python Library for Data Manipulation and Analysis","sidebarTitle":"Pandas","href":"/data-analysis/pandas"},{"title":"Matplotlib: Building Charts and Visualizations in Python","sidebarTitle":"Matplotlib","description":"Create line plots, histograms, scatter plots, bar charts, box plots, and multi-panel subplot grids with Matplotlib's pyplot interface.","href":"/data-analysis/matplotlib"},{"title":"Seaborn: Statistical Data Visualization for Python","sidebarTitle":"Seaborn","href":"/data-analysis/seaborn"},{"title":"Data Visualization Guide: Uni, Bi \u0026 Multivariate Analysis","sidebarTitle":"Viz Guide","description":"A practical guide to univariate, bivariate, and multivariate analysis using Matplotlib and Seaborn on a student performance dataset.","href":"/data-analysis/visualization-guide"}]},{"group":"FastAPI","pages":[{"title":"FastAPI Foundations: Build Production-Ready Python APIs","sidebarTitle":"Overview","href":"/fastapi-foundations/index"},{"title":"How the Web Works: HTTP Requests, Responses \u0026 Status Codes","sidebarTitle":"How Web Works","href":"/fastapi-foundations/how-web-works"},{"title":"Introduction to FastAPI: Install and Run Your First API","sidebarTitle":"Intro to FastAPI","href":"/fastapi-foundations/intro-to-fastapi"},{"title":"FastAPI Fundamentals: Routing, Params \u0026 Validation","sidebarTitle":"Fundamentals","href":"/fastapi-foundations/fundamentals"},{"title":"Request Handling in FastAPI: Params, Bodies \u0026 Headers","sidebarTitle":"Requests","href":"/fastapi-foundations/request-handling"},{"title":"Response Handling in FastAPI: Models, Codes \u0026 Errors","sidebarTitle":"Responses","href":"/fastapi-foundations/response-handling"},{"title":"FastAPI Data Validation and Pydantic Models in Python","sidebarTitle":"Validation","href":"/fastapi-foundations/data-validation-models"},{"title":"In-Memory CRUD Operations with FastAPI and Pydantic","sidebarTitle":"CRUD","href":"/fastapi-foundations/local-crud"},{"title":"API Documentation: Swagger UI and ReDoc in FastAPI","sidebarTitle":"API Docs","href":"/fastapi-foundations/api-documentation"},{"title":"Modular Routing with FastAPI APIRouter and Prefixes","sidebarTitle":"APIRouter","href":"/fastapi-foundations/apirouter"},{"title":"FastAPI Exception Handling: HTTP \u0026 Validation Errors","sidebarTitle":"Exceptions","href":"/fastapi-foundations/exception-handling"},{"title":"FastAPI Dependency Injection with Depends() Explained","sidebarTitle":"Dependencies","href":"/fastapi-foundations/dependency-injection"},{"title":"Modularising FastAPI: Controller, Service, Repository","sidebarTitle":"Modularisation","href":"/fastapi-foundations/modularisation"},{"title":"SQL \u0026 ORM Integration with FastAPI and SQLModel Guide","sidebarTitle":"SQL \u0026 ORM","href":"/fastapi-foundations/sql-orm"},{"title":"JWT Authentication and Role-Based Access in FastAPI","sidebarTitle":"JWT Auth","href":"/fastapi-foundations/jwt-auth"}]},{"group":"Frontend","pages":[{"title":"Introduction to Streamlit: Python Web Apps Without HTML","sidebarTitle":"Introduction","href":"/streamlit/intro"},{"title":"Displaying Text, Tables, and Media in Streamlit Apps","sidebarTitle":"Displaying Content","href":"/streamlit/displaying-content"},{"title":"Streamlit Widgets: Collecting and Handling User Input","sidebarTitle":"Widgets","href":"/streamlit/widgets"},{"title":"Working with Data, Charts, and Caching in Streamlit","sidebarTitle":"Data Handling","href":"/streamlit/data-handling"},{"title":"Building a Complete Streamlit Student Dashboard App","sidebarTitle":"Building Apps","href":"/streamlit/streamlit-app"}]}]}]},"basePath":"","title":"Seaborn: Statistical Data Visualization for Python - Python for AI \u0026 FastAPI","deploymentId":"dpl_6UE2cqB47X6P7P3F2hD3UphW6ijc","buildId":"dpl_6UE2cqB47X6P7P3F2hD3UphW6ijc","dynamics":[],"chunks":[]}