-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Jitter plot #2750
Copy link
Copy link
Closed
Description
It would be great if we can have either a jitter command or a jitter flag in scatter.
I'm refering to something like ggplot2's geom_jitter.
A basic solution:
def rand_jitter(arr):
stdev = arr.max()/100.
return arr + np.random.randn(len(arr)) * stdev
def jitter(x, y, s=20, c='b', marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, verts=None, hold=None, **kwargs):
return scatter(rand_jitter(x), rand_jitter(y), s=20, c='b', marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, verts=None, hold=None, **kwargs)
Of course the definition of stdev needs to be better, this will only work for some cases.
The idea is from this SoF post.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels