\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Arshdeep} \pdfinfo{ /Title (seaborn.pdf) /Creator (Cheatography) /Author (Arshdeep) /Subject (Seaborn Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{2972A3} \definecolor{LightBackground}{HTML}{F1F6F9} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Seaborn Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Arshdeep} via \textcolor{DarkBackground}{\uline{cheatography.com/201979/cs/43039/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Arshdeep \\ \uline{cheatography.com/arshdeep} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 14th April, 2024.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Introduction to Seaborn}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Seaborn}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Seaborn is a Python visualization library based on matplotlib that provides a high-level interface for drawing attractive statistical graphics. It is built on top of matplotlib and closely integrated with pandas data structures, making it an excellent tool for exploring and visualizing datasets.} \tn % Row Count 7 (+ 6) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Key Features}}} \tn % Row Count 8 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Simplified syntax for creating complex visualizations.} \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Built-in themes and color palettes to improve the aesthetics of plots.} \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Support for a wide range of statistical plots for exploring relationships in data.} \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Seamless integration with pandas DataFrames for easy data manipulation and visualization.} \tn % Row Count 16 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Capabilities for both univariate and multivariate visualizations.} \tn % Row Count 18 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Integration with matplotlib for fine-tuning and customization.} \tn % Row Count 20 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Getting Started}}} \tn % Row Count 21 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Install Seaborn using pip: pip install seaborn.} \tn % Row Count 22 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Import Seaborn in your Python script or Jupyter Notebook: import seaborn as sns.} \tn % Row Count 24 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Load your data into pandas DataFrame if not already in one.} \tn % Row Count 26 (+ 2) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Start exploring your data using Seaborn's high-level plotting functions.} \tn % Row Count 28 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.6 cm} x{4.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Installing Seaborn}} \tn % Row 0 \SetRowColor{LightBackground} Using pip & `pip install seaborn` \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Using conda & `conda install seaborn` \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} Verify Installation & `import seaborn as sns` \tn % Row Count 5 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Loading Data}} \tn % Row 0 \SetRowColor{LightBackground} Using Pandas & `import pandas as pd \{\{nl\}\}df = \seqsplit{pd.read\_csv('filename.csv')} \{\{nl\}\}\# Load CSV file` \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} Viewing Data & `df.head() \# View first few rows` \tn % Row Count 6 (+ 2) % Row 2 \SetRowColor{LightBackground} Understanding Data & `df.info() \{\{nl\}\}\# Summary of DataFrame \{\{nl\}\}df.describe() \{\{nl\}\}\# Descriptive statistics` \tn % Row Count 10 (+ 4) % Row 3 \SetRowColor{white} Handling Missing Data & `df.dropna() \{\{nl\}\}\# Drop rows with missing values \{\{nl\}\}df.fillna(value) \{\{nl\}\}\# Fill missing values` \tn % Row Count 15 (+ 5) % Row 4 \SetRowColor{LightBackground} Loading Built-in Datasets & `import seaborn as sns \{\{nl\}\}df = \seqsplit{sns.load\_dataset('dataset\_name')`} \tn % Row Count 18 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.36 cm} x{4.64 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Basic Plotting Functions}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{`sns.scatterplot(x}, y, data)` & Create a scatter plot to visualize the relationship between two variables. \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} `sns.lineplot(x, y, data)` & Generate a line plot to show trends in data over continuous intervals. \tn % Row Count 8 (+ 4) % Row 2 \SetRowColor{LightBackground} `sns.barplot(x, y, data)` & Construct a bar plot to display the distribution of categorical data. \tn % Row Count 11 (+ 3) % Row 3 \SetRowColor{white} \seqsplit{`sns.countplot(x}, data)` & Plot the frequency of unique values in a categorical variable. \tn % Row Count 14 (+ 3) % Row 4 \SetRowColor{LightBackground} `sns.boxplot(x, y, data)` & Draw a box plot to summarize the distribution of a continuous variable within different levels of a categorical variable. \tn % Row Count 20 (+ 6) % Row 5 \SetRowColor{white} \seqsplit{`sns.violinplot(x}, y, data)` & Create a violin plot to visualize the distribution of a continuous variable across different categories. \tn % Row Count 25 (+ 5) % Row 6 \SetRowColor{LightBackground} \seqsplit{`sns.histplot(data}, x)` & Generate a histogram to display the distribution of a single variable. \tn % Row Count 29 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.6 cm} x{4.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Customizing Plots}} \tn % Row 0 \SetRowColor{LightBackground} Changing Colors & Use the color parameter to specify colors for elements such as lines, markers, and bars. Seaborn also provides color palettes (palette parameter) for different visualizations. \tn % Row Count 8 (+ 8) % Row 1 \SetRowColor{white} Adjusting Line Styles and Markers & Control the style of lines with the linestyle parameter and markers with the marker parameter. Options include solid lines ('-'), dashed lines ('-{}-'), and various marker shapes ('o', 's', 'D', etc.). \tn % Row Count 18 (+ 10) % Row 2 \SetRowColor{LightBackground} Setting Plot Size & Use the \seqsplit{plt.figure(figsize=(width}, height)) function to specify the size of your plot. Adjust the width and height values as needed to achieve the desired dimensions. \tn % Row Count 26 (+ 8) % Row 3 \SetRowColor{white} Adding Titles and Labels & Set the title of your plot with plt.title() and label the axes with plt.xlabel() and plt.ylabel(). Provide informative titles and labels to make your plots more understandable. \tn % Row Count 34 (+ 8) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.6 cm} x{4.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Customizing Plots (cont)}} \tn % Row 4 \SetRowColor{LightBackground} Changing Font Sizes & Customize font sizes for titles, labels, and ticks using parameters such as fontsize or by accessing individual text elements. \tn % Row Count 6 (+ 6) % Row 5 \SetRowColor{white} Adjusting Axis Limits & Control the range of values displayed on the x and y axes using plt.xlim() and plt.ylim() functions. Set appropriate limits to focus on specific regions of interest in your data. \tn % Row Count 15 (+ 9) % Row 6 \SetRowColor{LightBackground} Adding Grid Lines & Use plt.grid(True) to display grid lines on your plot, aiding in data interpretation. \tn % Row Count 19 (+ 4) % Row 7 \SetRowColor{white} Adding Legends & Include a legend to distinguish between multiple elements in your plot using the plt.legend() function. Customize the legend labels and placement for clarity. \tn % Row Count 27 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.8 cm} x{5.2 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Saving Plots}} \tn % Row 0 \SetRowColor{LightBackground} Syntax & `import seaborn as sns \{\{nl\}\}\# Create your plot here \{\{nl\}\}sns.savefig("filename.extension")` \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} Example & `import seaborn as sns \{\{nl\}\}import matplotlib.pyplot as plt \{\{nl\}\}\# Create a scatter plot \{\{nl\}\}sns.scatterplot(x='x', y='y', \{\{nl\}\}data=data) \{\{nl\}\}\# Save the plot as a PNG file \{\{nl\}\}plt.savefig("scatter\_plot.png")` \tn % Row Count 13 (+ 9) % Row 2 \SetRowColor{LightBackground} Supported File Formats & PNG (Portable Network Graphics) \{\{nl\}\}JPG/JPEG (Joint Photographic Experts Group) \{\{nl\}\}PDF (Portable Document Format) \{\{nl\}\}SVG (Scalable Vector Graphics) \{\{nl\}\}and more \tn % Row Count 20 (+ 7) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Categorical Plots}} \tn % Row 0 \SetRowColor{LightBackground} barplot() & Displays the central tendency and confidence interval of numeric variables across different categories. Useful for comparing the mean or aggregate statistic of numeric data for each category. \tn % Row Count 10 (+ 10) % Row 1 \SetRowColor{white} countplot() & Shows the count of observations in each category using bars. Suitable for exploring the distribution of categorical variables. \tn % Row Count 17 (+ 7) % Row 2 \SetRowColor{LightBackground} boxplot() & Visualizes the distribution of quantitative data across different levels of one or more categorical variables. Useful for identifying outliers and comparing distributions. \tn % Row Count 26 (+ 9) % Row 3 \SetRowColor{white} violinplot() & Combines the benefits of a box plot and a kernel density plot. Provides information about the distribution of data within each category. \tn % Row Count 33 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Categorical Plots (cont)}} \tn % Row 4 \SetRowColor{LightBackground} stripplot() and swarmplot() & Scatterplots for categorical data. Show individual data points along with a categorical variable. Swarmplot avoids overlapping points by adjusting them along the categorical axis. \tn % Row Count 9 (+ 9) % Row 5 \SetRowColor{white} pointplot() & Represents the point estimates and confidence intervals using lines. Useful for visualizing the relationship between two categorical variables. \tn % Row Count 17 (+ 8) % Row 6 \SetRowColor{LightBackground} factorplot() (deprecated, use catplot() instead) & A versatile function that can create different types of categorical plots based on the kind parameter. Offers a convenient way to explore relationships between variables. \tn % Row Count 26 (+ 9) % Row 7 \SetRowColor{white} catplot() & Replaces factorplot and serves as a general plot function for categorical data. Supports various plot types such as stripplot, swarmplot, boxplot, etc., through the kind parameter. \tn % Row Count 35 (+ 9) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.92 cm} x{4.08 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Distribution Plots}} \tn % Row 0 \SetRowColor{LightBackground} Distribution Plots & Distribution plots in Seaborn allow you to visualize the distribution of a dataset. These plots help you understand the underlying distribution of your data, including its central tendency, spread, and skewness. \tn % Row Count 11 (+ 11) % Row 1 \SetRowColor{white} Histograms & sns.histplot(data, x='column'): Plot a histogram of the specified column in the dataset. Customize with parameters like bins, kde, color, and alpha. \tn % Row Count 19 (+ 8) % Row 2 \SetRowColor{LightBackground} Kernel Density Estimation (KDE) Plots & sns.kdeplot(data, x='column'): Generate a smooth estimate of the probability density function. Additional parameters include bw\_method, fill, and common\_norm. \tn % Row Count 27 (+ 8) % Row 3 \SetRowColor{white} Rug Plots & sns.rugplot(data, x='column'): Plot a line for each data point along the x-axis. Useful for visualizing individual data points in combination with other plots. \tn % Row Count 35 (+ 8) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.92 cm} x{4.08 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Distribution Plots (cont)}} \tn % Row 4 \SetRowColor{LightBackground} Cumulative Distribution Function (CDF) & sns.ecdfplot(data, x='column'): Plot the empirical cumulative distribution function. Helps to visualize the cumulative proportion of data points. \tn % Row Count 8 (+ 8) % Row 5 \SetRowColor{white} Joint Distribution Plots & \seqsplit{sns.jointplot(data=data}, x='x\_column', y='y\_column', kind='kind'): Plot the joint distribution of two variables along with their marginal distributions. kind parameter can be set to scatter, kde, hist, hex, or reg for different visualizations. \tn % Row Count 21 (+ 13) % Row 6 \SetRowColor{LightBackground} Pair Plots & sns.pairplot(data): Create pairwise plots for all numerical columns in the dataset. Offers a quick overview of relationships between multiple variables. \tn % Row Count 29 (+ 8) % Row 7 \SetRowColor{white} Violin Plots & \seqsplit{sns.violinplot(data=data}, x='x\_column', y='y\_column'): Visualize the distribution of a numeric variable for different categories. Provides insights into both the distribution and the probability density at different values. \tn % Row Count 41 (+ 12) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.92 cm} x{4.08 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Distribution Plots (cont)}} \tn % Row 8 \SetRowColor{LightBackground} Box Plots & \seqsplit{sns.boxplot(data=data}, x='x\_column', y='y\_column'): Summarize the distribution of a numeric variable for different categories using quartiles. Helps to identify outliers and compare distributions between categories. \tn % Row Count 11 (+ 11) % Row 9 \SetRowColor{white} Swarm Plots & \seqsplit{sns.swarmplot(data=data}, x='x\_column', y='y\_column'): Show each data point along with the distribution. Useful for small to moderate-sized datasets. \tn % Row Count 19 (+ 8) % Row 10 \SetRowColor{LightBackground} Violin-Swarm Combination & Combining violin and swarm plots can provide a comprehensive view of the distribution and individual data points. \tn % Row Count 25 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.72 cm} x{5.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Regression Plots}} \tn % Row 0 \SetRowColor{LightBackground} Regression Plots & Regression plots in Seaborn are useful for visualizing relationships between variables and fitting regression models to the data. Seaborn provides several functions for creating regression plots, allowing you to explore linear relationships, examine residuals, and detect outliers. \tn % Row Count 11 (+ 11) % Row 1 \SetRowColor{white} lmplot() & Used for plotting linear models. Syntax: sns.lmplot(x, y, data, ...). Displays scatter plot with a linear regression line. Useful for visualizing the relationship between two variables and assessing the fit of a linear model. \tn % Row Count 20 (+ 9) % Row 2 \SetRowColor{LightBackground} regplot() & Similar to lmplot() but can be used in more general contexts. Syntax: sns.regplot(x, y, data, ...). Produces scatter plot with a regression line. Offers additional customization options compared to lmplot(). \tn % Row Count 28 (+ 8) % Row 3 \SetRowColor{white} residplot() & Used for plotting the residuals of a linear regression. Syntax: sns.residplot(x, y, data, ...). Helps to diagnose the fit of the regression model by plotting the difference between observed and predicted values. Useful for identifying patterns or heteroscedasticity in residuals. \tn % Row Count 39 (+ 11) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.72 cm} x{5.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Regression Plots (cont)}} \tn % Row 4 \SetRowColor{LightBackground} Additional Parameters & order: Specifies the order of the polynomial regression (default is 1 for linear). scatter\_kws: Additional keyword arguments passed to the scatterplot function. line\_kws: Additional keyword arguments passed to the line plot function. ci: Confidence interval size for the regression estimate. truncate: Truncates the regression line at the data limits. \tn % Row Count 14 (+ 14) % Row 5 \SetRowColor{white} Example & `import seaborn as sns \{\{nl\}\}import matplotlib.pyplot as plt \{\{nl\}\}\# Load sample data \{\{nl\}\}tips = \seqsplit{sns.load\_dataset("tips")} \{\{nl\}\}\# Create a regression plot \{\{nl\}\}sns.lmplot(x="total\_bill", \{\{nl\}\}y="tip", data=tips) \{\{nl\}\}\# Show the plot \{\{nl\}\}plt.show()` \tn % Row Count 24 (+ 10) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2 cm} x{6 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Matrix Plots}} \tn % Row 0 \SetRowColor{LightBackground} Matrix Plots & Matrix plots in Seaborn are useful for visualizing data in matrix form, typically with heatmap-style representations. \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} Heatmaps & Use sns.heatmap() to create a colored matrix plot, with each cell representing the value of a variable in the dataset. Ideal for displaying correlation matrices or any two-dimensional data. \tn % Row Count 11 (+ 7) % Row 2 \SetRowColor{LightBackground} Cluster Maps & sns.clustermap() creates a hierarchical clustering heatmap. It's handy for exploring relationships between variables by grouping similar ones together. \tn % Row Count 17 (+ 6) % Row 3 \SetRowColor{white} Pair Plots & Although not strictly matrix plots, sns.pairplot() generates a matrix of scatterplots and histograms for quick visualization of relationships between multiple variables in a dataset. \tn % Row Count 24 (+ 7) % Row 4 \SetRowColor{LightBackground} \seqsplit{Customization} & Seaborn allows extensive customization of matrix plots, including adjusting color schemes, annotating cells with values, and tweaking axes. \tn % Row Count 29 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Time Series Plots}} \tn % Row 0 \SetRowColor{LightBackground} Time Series Plots & Time series plots in Seaborn are useful for visualizing data over time. Seaborn provides several functions to create informative time series plots. \tn % Row Count 8 (+ 8) % Row 1 \SetRowColor{white} `seaborn.lineplot(x, y, data)` & Creates a line plot of y vs. x with optional data argument. Ideal for visualizing trends and patterns over time. \tn % Row Count 14 (+ 6) % Row 2 \SetRowColor{LightBackground} `seaborn.relplot(x, y, data, \{\{nl\}\}kind='line')` & Offers a high-level interface to create various plot types, including line plots for time series data. Use the kind parameter to specify the plot type (default is 'line'). \tn % Row Count 23 (+ 9) % Row 3 \SetRowColor{white} \seqsplit{`seaborn.scatterplot(x}, y, data)` & Plots individual data points as scatter points. Suitable for visualizing relationships between variables over time. \tn % Row Count 29 (+ 6) % Row 4 \SetRowColor{LightBackground} \seqsplit{`seaborn.tsplot(data}, time, \{\{nl\}\}unit, value)` & Deprecated since Seaborn version 0.9. Use other functions for time series visualization. \tn % Row Count 34 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Time Series Plots (cont)}} \tn % Row 5 \SetRowColor{LightBackground} \seqsplit{`seaborn.linearmodels}.Tsplot(\{\{nl\}\}data, time, unit, value)` & Visualizes time series data with confidence intervals. Suitable for comparing multiple time series. \tn % Row Count 5 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Style and Aesthetics}} \tn % Row 0 \SetRowColor{LightBackground} Seaborn Styles & \seqsplit{seaborn.set\_style(style=None):} Set the aesthetic style of the plots. Styles include: 'darkgrid', 'whitegrid', 'dark', 'white', and 'ticks'. \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} Color Palettes & \seqsplit{seaborn.color\_palette(palette=None}, n\_colors=None, desat=None): Set the color palette for plots. Built-in palettes: 'deep', 'muted', 'bright', 'pastel', 'dark', 'colorblind', etc. Custom palettes can be created using \seqsplit{seaborn.color\_palette().} \tn % Row Count 17 (+ 11) % Row 2 \SetRowColor{LightBackground} Contexts & \seqsplit{seaborn.set\_context(context=None}, font\_scale=1, rc=None): Set the context parameters for the plot. Contexts control the scale of plot elements. Contexts include: 'paper', 'notebook', 'talk', and 'poster'. \tn % Row Count 26 (+ 9) % Row 3 \SetRowColor{white} Plot Aesthetics & \seqsplit{seaborn.despine(fig=None}, ax=None, top=True, right=True, left=False, bottom=False, offset=None, trim=False): Remove axes spines from the plot. \seqsplit{seaborn.set\_palette(palette}, n\_colors=None, desat=None, color\_codes=False): Set the color palette for the current seaborn context. \seqsplit{seaborn.set\_context(context=None}, font\_scale=1, rc=None): Set the plotting context parameters. \tn % Row Count 42 (+ 16) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Style and Aesthetics (cont)}} \tn % Row 4 \SetRowColor{LightBackground} Other Aesthetic Tweaks & seaborn.set(): Set aesthetic parameters in one step. \seqsplit{seaborn.reset\_defaults():} Restore default seaborn parameters. seaborn.set\_theme(): Set the default seaborn theme. \tn % Row Count 7 (+ 7) % Row 5 \SetRowColor{white} Saving Aesthetic Settings & \seqsplit{seaborn.axes\_style(style=None}, rc=None): Return a dictionary of parameters or use in a with statement to temporarily set the style. \seqsplit{seaborn.plotting\_context(context=None}, font\_scale=1, rc=None): Return a dictionary of parameters or use in a with statement to temporarily set the context. \tn % Row Count 19 (+ 12) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}