GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • PYTHON CHARTS
  • matplotlib
  • seaborn
  • plotly
  • pandas
  • colors
  • COLORS
  • COLOR PALETTES
  • R CODER
  • R CHARTS
  • Contact
  • Español

This view

  • Original page
  • New address

GeezerVison is showing python-charts.com — Boxenplot (letter-value plot) in seaborn

Search for a graph

HOME DISTRIBUTION BOXENPLOT SEABORN

Boxenplot (letter-value plot) in seaborn

Sample data

Copy the following code to get the data that will be used in the following examples.

import numpy as np
import seaborn as sns
import random

# Data simulation
rng = np.random.RandomState(5)
variable = rng.normal(0, 1, size = 2000)
random.seed(5)
group = random.choices(["G1", "G2", "G3"], k = 2000)
df = {'variable': variable, 'group': group}

Boxenplot in seaborn with boxenplot

A boxenplot (also called a letter-value plot) is a box plot with more quantile levels, which shows more detail about the shape of the distribution in the tails. It is most useful for larger data sets, where a regular box plot only shows the outliers as individual points instead of extra boxes.

import seaborn as sns

sns.boxenplot(x = "variable", data = df)

# Equivalent to:
sns.boxenplot(x = variable)

Boxenplot (letter-value plot) in seaborn

Grouped boxenplot

As with a regular box plot, pass a categorical variable to y (or x for a horizontal orientation) to draw one boxenplot per group.

import seaborn as sns

sns.boxenplot(x = "group", y = "variable", data = df)

Grouped boxenplot in seaborn

Colors

Use palette to assign a color per group, or color for a single fixed color.

import seaborn as sns

sns.boxenplot(x = "group", y = "variable", data = df, palette = "deep")

Colors of a boxenplot in seaborn

Number of levels

The number of quantile boxes is controlled by k_depth, which defaults to "tukey". Pass an integer to fix the number of levels manually, or "proportion" / "trustworthy" to let seaborn pick it based on other rules.

import seaborn as sns

sns.boxenplot(x = "variable", data = df, k_depth = 3)

Number of levels (k_depth) of a boxenplot in seaborn

Outline width

The width and color of the box outlines can be set with linewidth and linecolor.

import seaborn as sns

sns.boxenplot(x = "group", y = "variable", data = df,
              linewidth = 1.5, linecolor = "black")

Outline width of a boxenplot in seaborn

R CODER website
Storytelling with Data

Storytelling with Data

A Data Visualization Guide for Business Professionals

Buy on Amazon
Data Sketches

Data Sketches

A journey of imagination, exploration, and beautiful data visualizations

Buy on Amazon

See also

Box plot in seaborn

Box plot in seaborn

Violin plot in matplotlib

Violin plot in matplotlib

Kernel density plot in seaborn with kdeplot

Kernel density plot in seaborn with kdeplot

Box plot in matplotlib

Box plot in matplotlib

Histogram in matplotlib

Histogram in matplotlib

Violin plot in seaborn

Violin plot in seaborn

Histogram with density in seaborn

Histogram with density in seaborn

Violin plots in plotly

Violin plots in plotly

Strip plot in seaborn

Strip plot in seaborn

Box plot in plotly

Box plot in plotly

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.