seaborn.stripplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, jitter=False, split=False, orient=None, color=None, palette=None, size=5, edgecolor='gray', linewidth=0, ax=None, **kwargs)

Draw a scatterplot where one variable is categorical.

A strip plot can be drawn on its own, but it is also a good complement to a box or violin plot in cases where you want to show all observations along with some representation of the underlying distribution.

Input data can be passed in a variety of formats, including:

  • Vectors of data represented as lists, numpy arrays, or pandas Series objects passed directly to the x, y, and/or hue parameters.
  • A “long-form” DataFrame, in which case the x, y, and hue variables will determine how the data are plotted.
  • A “wide-form” DataFrame, such that each numeric column will be plotted.
  • Anything accepted by plt.boxplot (e.g. a 2d array or list of vectors)

In most cases, it is possible to use numpy or Python objects, but pandas objects are preferable because the associated names will be used to annotate the axes. Additionally, you can use Categorical types for the grouping variables to control the order of plot elements.


x, y, hue : names of variables in data or vector data, optional

Inputs for plotting long-form data. See examples for interpretation.

data : DataFrame, array, or list of arrays, optional

Dataset for plotting. If x and y are absent, this is interpreted as wide-form. Otherwise it is expected to be long-form.

order, hue_order : lists of strings, optional

Order to plot the categorical levels in, otherwise the levels are inferred from the data objects.

jitter : float, True/1 is special-cased, optional

Amount of jitter (only along the categorical axis) to apply. This can be useful when you have many points and they overlap, so that it is easier to see the distribution. You can specify the amount of jitter (half the width of the uniform random variable support), or just use True for a good default.

split : bool, optional

When using hue nesting, setting this to True will separate the strips for different hue levels along the categorical axis. Otherwise, the points for each level will be plotted on top of each other.

orient : “v” | “h”, optional

Orientation of the plot (vertical or horizontal). This is usually inferred from the dtype of the input variables, but can be used to specify when the “categorical” variable is a numeric or when plotting wide-form data.

color : matplotlib color, optional

Color for all of the elements, or seed for light_palette() when using hue nesting.

palette : seaborn color palette or dict, optional

Colors to use for the different levels of the hue variable. Should be something that can be interpreted by color_palette(), or a dictionary mapping hue levels to matplotlib colors.

size : float, optional

Diameter of the markers, in points. (Although plt.scatter is used to draw the points, the size argument here takes a “normal” markersize and not size^2 like plt.scatter.

edgecolor : matplotlib color, “gray” is special-cased, optional

Color of the lines around each point. If you pass "gray", the brightness is determined by the color palette used for the body of the points.

linewidth : float, optional

Width of the gray lines that frame the plot elements.

ax : matplotlib Axes, optional

Axes object to draw the plot onto, otherwise uses the current Axes.


ax : matplotlib Axes

Returns the Axes object with the boxplot drawn onto it.

See also

A categorical scatterplot where the points do not overlap. Can be used with other plots to show each observation.
A traditional box-and-whisker plot with a similar API.
A combination of boxplot and kernel density estimation.


Draw a single horizontal strip plot:

>>> import seaborn as sns
>>> sns.set_style("whitegrid")
>>> tips = sns.load_dataset("tips")
>>> ax = sns.stripplot(x=tips["total_bill"])

Group the strips by a categorical variable:

>>> ax = sns.stripplot(x="day", y="total_bill", data=tips)

Add jitter to bring out the distribution of values:

>>> ax = sns.stripplot(x="day", y="total_bill", data=tips, jitter=True)

Use a smaller amount of jitter:

>>> ax = sns.stripplot(x="day", y="total_bill", data=tips, jitter=0.05)

Draw horizontal strips:

>>> ax = sns.stripplot(x="total_bill", y="day", data=tips,
...                    jitter=True)

Draw outlines around the points:

>>> ax = sns.stripplot(x="total_bill", y="day", data=tips,
...                    jitter=True, linewidth=1)

Nest the strips within a second categorical variable:

>>> ax = sns.stripplot(x="sex", y="total_bill", hue="day",
...                    data=tips, jitter=True)

Draw each level of the hue variable at different locations on the major categorical axis:

>>> ax = sns.stripplot(x="day", y="total_bill", hue="smoker",
...                    data=tips, jitter=True,
...                    palette="Set2", split=True)

Control strip order by passing an explicit order:

>>> ax = sns.stripplot(x="time", y="tip", data=tips,
...                    order=["Dinner", "Lunch"])

Draw strips with large points and different aesthetics:

>>> ax =  sns.stripplot("day", "total_bill", "smoker", data=tips,
...                    palette="Set2", size=20, marker="D",
...                    edgecolor="gray", alpha=.25)

Draw strips of observations on top of a box plot:

>>> ax = sns.boxplot(x="tip", y="day", data=tips, whis=np.inf)
>>> ax = sns.stripplot(x="tip", y="day", data=tips,
...                    jitter=True, color=".3")

Draw strips of observations on top of a violin plot:

>>> ax = sns.violinplot(x="day", y="total_bill", data=tips,
...                     inner=None, color=".8")
>>> ax = sns.stripplot(x="day", y="total_bill", data=tips, jitter=True)