# seaborn

## #82 Marginal plot with Seaborn

A marginal plot allows to study the relationship between 2 numeric variables. The central chart display their correlation. It is usually a scatterplot, a hexbin plot, a 2D histogram or a 2D density plot. The marginal charts,…

## #111 Custom correlogram

The graph #110 showed how to make a basic correlogram with seaborn. This post aims to explain how to improve it. It is divided in 2 parts: how to custom the correlation observation (for each pair of numeric variable), and…

## #110 Basic Correlation matrix with Seaborn

Seaborn allows to make a correlogram or correlation matrix really easily. Correlogram are awesome for exploratory analysis: it allows to quickly observe the relationship between every variable of your matrix. It is easy to do it…

## #106 Seaborn style on matplotlib plot

Matplotlib allows to make absolutely any type of chart, but its style does not look very great. It is possible to benefit the seaborn library style really easily: just the load the seaborn library before your plot!

## #104 Seaborn Themes

The Seaborn python library is well known for its grey background and its general styling. However, note that a few other built in style are available: darkgrid, white grid, dark, white and ticks. Here is how to call them:

## #101 Make a color palette with Seaborn

The post #196 describes how to pick up a single color with matplotlib or seaborn. This post aims to describe a few color palette that are provided, and to explain how to call them in a Seaborn plot. There are…

## #100 Calling a color with seaborn

Calling a color with seaborn works exactly the same way than with matplotlib. Thus, see the dedicated page that gives extensive explanations. However, here is a list of the available colors if you want to call them by their…

## #80 Contour plot with seaborn

Here are 3 contour plots made using the seaborn python library. You have to provide 2 numerical variables as input (one for each axis). The function will calculate the kernel density estimate and represent it as a contour plot or…

## #58 Show number of observation on violinplot

It is a good practice to specify the number of observation for each group of your violinplot. Indeed, a group with 10 observation can look the same as a group with 10000, what can highly…

## #55 Control order of groups in violinplot | seaborn

Here are 2 tips to order your seaborn violinplot.

## #54 Grouped violinplot

If you have one numerical variable, several groups, and subgroups, you probably need to make a grouped violinplot. Note that you can use faceting as well to solve this kind of dataset.      …

## #53 Control color of seaborn violinplot

Color is probably the first feature you want to control on your seaborn violinplot. Here I give 4 tricks to control it:

## #52 Custom seaborn violinplot

You can custom some features of seaborn violinplots. Here are 2 examples showing how to change linewidth (left) and general width of each group (right).

## #51 Horizontal violinplot

Once you know how to make a violinplot with seaborn, it is quite straightforward to turn it horizontal.

## #50 Basic violinplot and input formats

This post aims to describe how to realize a basic violinplot. It explains how your input must be formated and which function of seaborn you need to use. Three input formats exist to draw a violinplot:

## #74 Density plot of several variables

Sometimes it is useful to plot the distribution of several variables on the same plot to compare them. This is possible using the kdeplot function of seaborn several times:

## #73 Control bandwidth of seaborn density plot

These 2 density plots have been made using the same data. Only the bandwidth changes from 0.5 on the left to 0.05 on the right. This is controlled using the bw argument of the kdeplot function (seaborn library).

## #72 Horizontal density plot

Once you understood how to build a basic density plot with seaborn, it is really easy to turn it horizontal.

## #71 Density plot with shade | seaborn

Once you understood how to build a basic density plot with seaborn, it is really easy to add a shade under the line:

## #70 Basic density plot with seaborn

With seaborn, a  density plot is made using the kdeplot function. As input, density plot need only one numerical variable. See how to use this function below:

## #94 Use normalization on seaborn heatmap

Sometimes, a normalization step is necessary to find out patterns in your heatmap. Check the left heatmap: an individual has higher values than others. Thus, he absorbs all the color variation: his column appears yellow and the rest of the…

## #92 Control color in seaborn heatmaps

Once you understood how to make a heatmap with seaborn and how to make basic customization, you probably want to control the color palette. This is a crucial step since the message provided by your heatmap can be different following…

## #91 Customize seaborn heatmap

The graph #90 explains how to make a heatmap from 3 different input formats. In this post, I describe how to customize the appearance of these heatmaps. These 4 examples start by importing libraries and making a data frame:

## #90 Heatmaps with various input format

This post explains how to make heatmaps with python and seaborn. Three main types of input exist to plot heatmap, let’s study them one by one.

## #45 Control color of each marker | seaborn

The graph #41 shows how to custom the features of markers and the #43 shows how to map a categorical value to a color. But sometimes, you need to have a more precise control on…

## #44 Control axis limits of plot | seaborn

Control the limits of the X and Y axis of your plot using the matplotlib function plt.xlim and plt.ylim.

## #43 Use categorical variable to color scatterplot | seaborn

Once you understood how to make a basic scatterplot with seaborn and how to custom shapes and color, you probably want the color corresponds to a categorical variable (a group). This is possible using the hue argument: it’s here that…

## #42 Custom linear regression fit | seaborn

You can custom the appearance of the regression fit proposed by seaborn. In this example, color, transparency and width are controlled through the line_kws={} option.

## #41 Control marker features

Once you understood how to plot a basic scatterplot with seaborn, you probably want to custom the appearance of your markers. You can custom color, transparency, shape and size. Here is how to do it: Control shape List of available…

## #40 Basic scatterplot | seaborn

Using seaborn, scatterplots are made using the regplot() function. Here is an example showing the most basic utilization of this function. You have to provide at least 2 lists: the positions of points on the X and Y axis. By…

## #38 Show number of observation on boxplot

Boxplot is an amazing way to study distributions. However, it can be useful to display the number of observation for each group since this info is hidden under boxes.

## #36 Add jitter over boxplot | seaborn

Boxplot is an amazing way to study distributions. However, note that different type of distribution can be hidden under the same box. Thus, it is highly advised to display every observations over your boxplot, to be…

## #35 Control order of boxplot

Boxplots often give more information if you order group in a specific order. This is feasible with seaborn.  Here are 2 examples explaining the 2 main needs you can have:

## #34 Grouped Boxplot

Grouped boxplot are used when you have a numerical variable, several groups and subgroups. It is easy to realize one using seaborn.Y is your numerical variable, x is the group column, and hue is the subgroup…

## #33 Control colors of boxplot | seaborn

This post gives 5 tips to manage the color of your seaborn boxplot:

## #31 Horizontal boxplot with seaborn

It is quite straight forward to turn your boxplot horizontal with seaborn. You can switch your x and y attributes, or use the option ‘orient=”h”‘

## #30 Basic Boxplot with Seaborn

This page aims to explain how to plot a basic boxplot with seaborn. Boxplot are made using the … boxplot() function! Three types of input can be used to make a boxplot:

## #25 Histogram with several variables | Seaborn

If you have several numeric variables and want to visualize their distributions together, you have 2 options: plot them on the same axis (left), or split your windows in several parts (faceting, right). The first option is nicer if you…

## #24 Histogram with a boxplot on top | seaborn

This chart is mainly based on seaborn but necessitates matplotlib as well, to split the graphic window in 2 parts. If you need to learn how to custom individual charts, visit the histogram and boxplot sections.

## #23 Vertical Histogram

It is quite straightforward to make your histogram vertical with seaborn, just add vertical=True as an option.

## #21 Control rug and density on seaborn histogram

By default, the displot function of seaborn plots an histogram with a density curve (see graph #20). You can easily remove the density using the option kde=”False”. You can also control the presence of rugs using rug=”True”. You can custom…

## #20 Basic histogram | Seaborn

With Seaborn, histograms are made using the distplot function. You can call the function with default values (left), what already gives a nice chart. Do not forget to play with the number of bins using the ‘bins’ argument. It is…