Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example script making a Joy Divsion plot #1238

Merged
merged 5 commits into from
Jul 15, 2017
Merged

Add example script making a Joy Divsion plot #1238

merged 5 commits into from
Jul 15, 2017

Conversation

mwaskom
Copy link
Owner

@mwaskom mwaskom commented Jul 14, 2017

People seem really interested in these lately, anyway, it's not too hard ¯\_(ツ)_/¯

image

@mwaskom
Copy link
Owner Author

mwaskom commented Jul 14, 2017

Change in kdeplot isn't essential for the example I converged on, but it was useful for a few other candidates (i.e. using a solid fill color that matchee the background, which is closest to the original album illustration).

@mwaskom
Copy link
Owner Author

mwaskom commented Jul 14, 2017

It's even simpler if you're not fussy, but where's the fun in that?

g = sns.FacetGrid(df, row="g", hue="g", aspect=12, size=.5, palette="tab10")
g.map(sns.kdeplot, "x", clip_on=False, shade=True, alpha=1, bw=.25, lw=1.5)
g.add_legend(title="")
g.set_titles("")
g.fig.subplots_adjust(hspace=-.25)
g.despine(bottom=True, left=True)
g.set(yticks=[])

@mwaskom mwaskom merged commit 5935395 into master Jul 15, 2017
@mwaskom mwaskom deleted the joyplot branch July 15, 2017 13:40
@lukauskas
Copy link
Contributor

How would you feel about making this a high-level function, just likesns.violinplot is?
I think it would be used as much, if not more.

@mwaskom
Copy link
Owner Author

mwaskom commented Aug 4, 2017

I would be opposed.

@lukauskas
Copy link
Contributor

Why? maintenance overhead?

@mwaskom
Copy link
Owner Author

mwaskom commented Aug 4, 2017

I think they're fundamentally pretty gimmicky and not actually a good way to visualize data. The point of the example is mostly to take something people think is neat and use it to demonstrate how to go beyond the normal usage pattern for FacetGrid.

@lukauskas
Copy link
Contributor

I don't know... Yes it is a popular gimmick nowadays, but I think it would be useful in seaborn.

Particularly, it would fill in a gap where we currently have no high-level way to facet kdeplots without the FacetGrid. There is violinplot, but its weakness is the mirroring of the KDE around one axis. I've run into a few cases where my violin plot was breaking down because I had too many 'violins', but could have easily been readable if I just drew half a violin only. Sort of like split=True parameter, but without the second half. This is essentially what a joy plot does. Overlap between KDEs simply reduces the space even more.

Whether it is as a useful visualisation feature, that's subjective, but in my opinion it's great if:

  1. You're only interested in distribution in one dimension;
  2. The distribution cannot be summarised easily (e.g. bimodal);
  3. You cannot simply plot all the points (perhaps there is too much data?);
  4. The axis you are faceting is ordinal.

Twitter has a few nice examples (1, 2, 3). Even though they do not meet all the criteria above.

I think I've seen a similar visualisation in the lab as well, I think FACS uses a similar visualisation for its results, which means people familiar with it would find these easy to understand too.

@mwaskom
Copy link
Owner Author

mwaskom commented Aug 4, 2017

I remain unconvinced, but I'll remind you that ggjoy is not actually part of ggplot. If you think it would be useful, you should write a function that builds on this example and put it on PyPi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants