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

Density geometries revamp #1152

Open
6 tasks
tlnagy opened this issue May 25, 2018 · 2 comments · May be fixed by #1157
Open
6 tasks

Density geometries revamp #1152

tlnagy opened this issue May 25, 2018 · 2 comments · May be fixed by #1157
Assignees

Comments

@tlnagy
Copy link
Member

tlnagy commented May 25, 2018

As discussed in #1151, Gadfly.jl's current implementation of violin plots (and to a lesser extent, density plots) is fairly limited as compared to our equivalent ecosystems for other languages (e.g. seaborn's violins and ggplot's violins).

Current limitations

  • Not possible to change orientation of violinplots. The primary grouping currently has to be on the x axis so violins cannot be horizontal.

  • Major duplication of code between Stat.density and Stat.violin

  • Not possible to stack densities

    • Three main options for position, (1) :identity: what we do now (2) :stack stack densities on top of each other like we do in Geom.bar (3) :fill normalize such that for each position along the densities, the total always equals 1
  • Not possible to adjust scaling of density plots, i.e. all Gadfly violins/density plots always have an area of 1. It would help to add the option of using unnormalized counts.

  • Currently impossible to group violins according to a 2nd variable (e.g. group by color and x)

    • This would need to be a generalization of @Mattriks' solution in Geom.violin with color #1081. Essentially, there are four cases: (1) if no color aesthetic is mapped, then use the default_color (2) if there is a 1 to 1 mapping between the color aesthetic and the primary grouping (e.g. the x categorical variable) then use the solution in Geom.violin with color #1081, (3) if there isn't a 1 to 1 mapping and fewer colors than x groupings then also use solution Geom.violin with color #1081 (4) group by primary variable, then by color (allowing split violins).
  • Several inefficiencies with the code (we could do quite a bit of preallocation that we don't do related to the KDE since we know how many datapoints there will be in advance)

Examples

Case Example solution
Split violin grouped by x, color. Uses raw counts, area ≠ 1 image
Case (3) for violin plots from above image
Horizontal violins image
Use raw counts image
Stacked densities image
Filled densities image
@tlnagy tlnagy self-assigned this May 25, 2018
tlnagy added a commit that referenced this issue May 28, 2018
working on #1152.

Note: This is a WIP and currently completely breaks `Geom.density` and
`Geom.violin` has several regressions.
@tlnagy tlnagy linked a pull request May 28, 2018 that will close this issue
9 tasks
tlnagy added a commit that referenced this issue Jun 3, 2018
working on #1152.

Note: This is a WIP and currently completely breaks `Geom.density` and
`Geom.violin` has several regressions.
@ValdarT
Copy link

ValdarT commented Feb 12, 2019

Are there any recent developments in this regard? Especially interested in the split violins.

@tlnagy
Copy link
Member Author

tlnagy commented Feb 13, 2019

This PR needs quite a bit of work since we went through the whole 1.0 revamp since then. I'll eventually get to it if no one gets to it first. Bit swamped right now.

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

Successfully merging a pull request may close this issue.

2 participants