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

Stats in Geom.subplot_grid #1516

Open
Mattriks opened this issue Jan 25, 2021 · 3 comments · May be fixed by #1520
Open

Stats in Geom.subplot_grid #1516

Mattriks opened this issue Jan 25, 2021 · 3 comments · May be fixed by #1520
Assignees

Comments

@Mattriks
Copy link
Member

In the main Gadfly plot, Stats and Geoms that are not in layers, are both pushed into a layer (which makes sense). This means the statistics field of the main plot (p1.statistics below) is actually obsolete.

p1 = plot(Stat.smooth, Geom.ribbon)
p1.statistics #  StatisticElement[]
 p1.layers[1].statistics # StatisticElement[Stat.smooth()]
 p1.layers[1].geom # Geom.ribbon() 

Geom.subplot_grid has similar fields to the main plot. In subplot_grid Geoms that are not in layers get pushed to a layer,
but Stats get pushed to the statistics field of subplot_grid (p2.statistics below). This is problematic,
because the Stat and Geom don't have a clear association (this is worse when attempting to use multiple Stats/Geoms).

p2 = Geom.subplot_grid(Stat.smooth, Geom.ribbon)
p2.statistics  # StatisticElement[Stat.smooth()]
 p2.layers[1].statistics # StatisticElement[]
 p2.layers[1].geom # Geom.ribbon()

The decoupling of the Stat/Geom makes it makes it unclear what the purpose of p2.statistics is, leading to bad coding.

@Mattriks Mattriks self-assigned this Jan 25, 2021
@tlnagy
Copy link
Member

tlnagy commented Feb 18, 2021

Do you propose then to remove p2.statistics and push all stats to p2.layers[1].statistics?

@Mattriks
Copy link
Member Author

Not all stats to one layer, but to the appropriate layer, as happens in a plot with multiple layers. I'm close to having a PR ready.

@Mattriks Mattriks linked a pull request Feb 19, 2021 that will close this issue
2 tasks
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 a pull request may close this issue.

2 participants