Implement geom_beeswarm using a quasi-random algorithm - #1068
Conversation
The method uses the van der Corput algorithm to produce a low discrepancy sequence between 0 and 1.
|
Just checking if this feature is of interest? |
Yes. I will get to it before the next minor release v0.16.0. |
has2k1
left a comment
There was a problem hiding this comment.
I could also refactor the PR, so that
stat_sinaandstat_beeswarmuse a common code base.
They do have a lot of code in common and it would be make sense if the refactor can extract some meaningful structure beyond the stat methods. Otherwise we can leave it as it is.
| all_integers = (y == np.floor(y)).all() | ||
| some_are_unique = len(np.unique(y)) > 1 | ||
| if all_integers and some_are_unique: | ||
| # TODO: expose random_state as a stat parameter for reproducibility |
|
|
||
| n = 50 | ||
| random_state = np.random.RandomState(123) | ||
| uni = random_state.chisquare(17, n) |
There was a problem hiding this comment.
Reduce the degrees of freedom so that geometries in the test can cover more area.
|
Hey, I don't think I will get around to making the changes this week. If you would like to include the feature in the upcoming release, feel free to make any edits necessary. Otherwise, I hope to have some more free time for this in September :) |
Fixes #318.
This PR implements a beeswarm algorithm that produces a (in my opinion) visually more appealing output than the random sampling implemented in geom_sina.
The code and unit testes are mostly copied from [geom|stat]_sina. I removed the
random_stateparameter as it isn't needed anymore (except when jitter is called). I wasn't sure what the best way to do here is, so any feedback would be appreciated.I could also refactor the PR, so that stat_sina and stat_beeswarm use a common code base.