Skip to content

Commit

Permalink
Update stripplot docs and examples with jitter=True default
Browse files Browse the repository at this point in the history
  • Loading branch information
MaozGelbart committed Apr 18, 2019
1 parent b9551af commit cdfd63e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
3 changes: 1 addition & 2 deletions examples/jitter_stripplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

# Show each observation with a scatterplot
sns.stripplot(x="value", y="measurement", hue="species",
data=iris, dodge=True, jitter=True,
alpha=.25, zorder=1)
data=iris, dodge=True, alpha=.25, zorder=1)

# Show the conditional means
sns.pointplot(x="value", y="measurement", hue="species",
Expand Down
37 changes: 13 additions & 24 deletions seaborn/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -2810,11 +2810,11 @@ def stripplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None,
{categorical_data}
{order_vars}
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.
Amount of jitter (only along the categorical axis) to apply. Defaults
to ``True``. 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 leave untouched for a good default.
dodge : bool, optional
When using ``hue`` nesting, setting this to ``True`` will separate
the strips for different hue levels along the categorical axis.
Expand All @@ -2824,7 +2824,7 @@ def stripplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None,
{color}
{palette}
size : float, optional
Diameter of the markers, in points. (Although ``plt.scatter`` is used
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
Expand Down Expand Up @@ -2864,13 +2864,6 @@ def stripplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None,
>>> ax = sns.stripplot(x="day", y="total_bill", data=tips)
Add jitter to bring out the distribution of values:
.. plot::
:context: close-figs
>>> ax = sns.stripplot(x="day", y="total_bill", data=tips, jitter=True)
Use a smaller amount of jitter:
.. plot::
Expand All @@ -2883,24 +2876,22 @@ def stripplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None,
.. plot::
:context: close-figs
>>> ax = sns.stripplot(x="total_bill", y="day", data=tips,
... jitter=True)
>>> ax = sns.stripplot(x="total_bill", y="day", data=tips)
Draw outlines around the points:
.. plot::
:context: close-figs
>>> ax = sns.stripplot(x="total_bill", y="day", data=tips,
... jitter=True, linewidth=1)
... linewidth=1)
Nest the strips within a second categorical variable:
.. plot::
:context: close-figs
>>> ax = sns.stripplot(x="sex", y="total_bill", hue="day",
... data=tips, jitter=True)
>>> ax = sns.stripplot(x="sex", y="total_bill", hue="day", data=tips)
Draw each level of the ``hue`` variable at different locations on the
major categorical axis:
Expand All @@ -2909,8 +2900,7 @@ def stripplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None,
:context: close-figs
>>> ax = sns.stripplot(x="day", y="total_bill", hue="smoker",
... data=tips, jitter=True,
... palette="Set2", dodge=True)
... data=tips, palette="Set2", dodge=True)
Control strip order by passing an explicit order:
Expand All @@ -2934,9 +2924,9 @@ def stripplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None,
.. plot::
:context: close-figs
>>> import numpy as np
>>> 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")
>>> ax = sns.stripplot(x="tip", y="day", data=tips, color=".3")
Draw strips of observations on top of a violin plot:
Expand All @@ -2945,7 +2935,7 @@ def stripplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None,
>>> 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)
>>> ax = sns.stripplot(x="day", y="total_bill", data=tips)
Use :func:`catplot` to combine a :func:`stripplot` and a
:class:`FacetGrid`. This allows grouping within additional categorical
Expand All @@ -2958,7 +2948,6 @@ def stripplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None,
>>> g = sns.catplot(x="sex", y="total_bill",
... hue="smoker", col="time",
... data=tips, kind="strip",
... jitter=True,
... height=4, aspect=.7);
""").format(**_categorical_docs)
Expand Down

0 comments on commit cdfd63e

Please sign in to comment.