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

Shared autobin for overlaid histograms #3749

Closed
nicolaskruchten opened this issue Apr 9, 2019 · 13 comments · Fixed by #3845
Closed

Shared autobin for overlaid histograms #3749

nicolaskruchten opened this issue Apr 9, 2019 · 13 comments · Fixed by #3845
Assignees
Labels
feature something new
Milestone

Comments

@nicolaskruchten
Copy link
Contributor

For px we need some new attrs to get histograms to share autobin logic even when in overlay mode (they currently do so in the other modes by default).

Ref #3515

@etpinard etpinard added the feature something new label Apr 10, 2019
@etpinard etpinard added this to the v1.48.0 milestone Apr 11, 2019
@etpinard etpinard self-assigned this Apr 26, 2019
@etpinard
Copy link
Contributor

Similar to #3515 (comment):

  • Should bingroup for overlaid histograms only work for traces on the same bin axis and across matching axes?

Furthermore, what does bingroup mean for graphs with barmode other than 'overlay'? Should we even coerce bingroup for non-overlay barmodes? Or, should we allow users to place stacked/grouped histograms on the same (or matching) binning axis in different binning groups using bingroup?

@alexcjohnson
Copy link
Collaborator

How about we just force bingroup to match within a stack/group? ie have it inherit from the first trace in the group that sets a bingroup. That way you could choose to have a stack overlaid by another single trace, or another stack/group on a stacked or matching subplot, all sharing bin settings.

@etpinard
Copy link
Contributor

How about we just force bingroup to match within a stack/group?

Yep, that sounds about right. With this and #3515 (comment) , we'll have a pretty robust bingroup behavior.

@nicolaskruchten
Copy link
Contributor Author

How about we just force bingroup to match within a stack/group?

Not sure what the implications of that are... can you unpack please?

@alexcjohnson
Copy link
Collaborator

It wouldn't make sense to have incompatible bins within a single stack or group - you need to have matching position values, and we already do force this in the stacking/grouping code. Since that's exactly what we're talking about here, but extending this forcing to other traces that aren't otherwise known to need compatible positions, we might as well make this correspondence explicit: instead of inferring that a set of traces need to be forced into compatible positions based on their stacking or grouping, it becomes a 2-step process. (1) infer that these traces need to have the same bingroup (2) use that bingroup (along with any other traces we've put into the same group) to force compatible positions.

@nicolaskruchten
Copy link
Contributor Author

But.... this issue is about overlaid histograms, not grouped or stacked ones, right?

I'm having trouble seeing what the API implications are here. I was expecting some new attr that I could set somewhere that said "share bins" that would kick in if the bars are overlaid.

@alexcjohnson
Copy link
Collaborator

With alignmentgroup and offsetgroup you can have all of those together - a single histogram overlaying a stack or a group, or multiple stacks... also need to consider multiple subplots, stacked or otherwise, and the desire to share binning across these. So yes, the simple case would be several overlaid histograms but there's a lot more you can imagine doing with bin groups.

@nicolaskruchten
Copy link
Contributor Author

Oh I see. ok then. Still curious what the final API would look like :)

@nicolaskruchten
Copy link
Contributor Author

For e.g. the simple case of two histograms that are currently overlaid.

@etpinard
Copy link
Contributor

etpinard commented Apr 30, 2019

Still curious what the final API would look like :)
For e.g. the simple case of two histograms that are currently overlaid.

Plotly.newPlot(gd, [{
  type: 'histogram',
  x: [1,1,2,3,3,4],
  opacity: 0.8,
  bingroup: '1'
}, {
  type: 'histogram',
  x: [2,4,4,1,2,3],
  opacity: 0.8,
  bingroup: '1'
}], {
  barmode: 'overlay'
})

that looks like:

image

with auto-bins {size: 1, start: 0.5, end: 4.5}

@nicolaskruchten
Copy link
Contributor Author

Ah ok this makes sense. Too many stack/alignment/bin-group possibilities for my pre-coffee brain to think about though :)

@nicolaskruchten
Copy link
Contributor Author

does it make sense to do #3614 first?

@etpinard
Copy link
Contributor

etpinard commented May 1, 2019

does it make sense to do #3614 first?

I'm starting to think that, yes maybe we should get stackgroup in there in 1.48.0

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

Successfully merging a pull request may close this issue.

3 participants