seaborn.
stripplot
(x=None, y=None, hue=None, data=None, order=None, hue_order=None, jitter=False, dodge=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:
x
, y
, and/or hue
parameters.x
, y
, and hue
variables will determine how the data are plotted.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.
Parameters:  x, y, hue : names of variables in
data : DataFrame, array, or list of arrays, optional
order, hue_order : lists of strings, optional
jitter : float,
split : bool, optional
orient : “v”  “h”, optional
color : matplotlib color, optional
palette : palette name, list, or dict, optional
size : float, optional
edgecolor : matplotlib color, “gray” is specialcased, optional
linewidth : float, optional
ax : matplotlib Axes, optional


Returns:  ax : matplotlib Axes

See also
swarmplot
boxplot
violinplot
Examples
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", dodge=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)
Use factorplot()
to combine a stripplot()
and a
FacetGrid
. This allows grouping within additional categorical
variables. Using factorplot()
is safer than using FacetGrid
directly, as it ensures synchronization of variable order across facets:
>>> g = sns.factorplot(x="sex", y="total_bill",
... hue="smoker", col="time",
... data=tips, kind="strip",
... jitter=True,
... size=4, aspect=.7);