Issue
Is there a keyword argument that can be passed to seaborn.stripplot
so that each strip can be, say 2x wider than it would be by default?
In one of the example plots in the stripplot
doc, the points for "tip" are too compact to really be distinguished. The size of each point could be decreased, but this works only up to a point. So it would seem useful if each strip could be widened to fill most of the plot, with bumpers in between each strip.
Solution
The relevant parameter is jitter
:
jitter
: 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 useTrue
for a good default.
Here are some examples of the default, jitter=0.2
, and jitter=0.4
:
import seaborn as sns
import matplotlib.pyplot as plt
tips = sns.load_dataset('tips')
fig, (ax1, ax2, ax3) = plt.subplots(1, 3)
sns.stripplot(ax=ax1, data=tips)
sns.stripplot(ax=ax2, data=tips, jitter=0.2)
sns.stripplot(ax=ax3, data=tips, jitter=0.4)
Answered By - tdy
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.