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

bingroup #200

Closed
wants to merge 3 commits into from
Closed

bingroup #200

wants to merge 3 commits into from

Conversation

Mahdis-z
Copy link
Contributor

No description provided.

@emmanuelle emmanuelle self-assigned this Nov 13, 2019

fig.show()
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be interesting to show the behaviour with and without bingroup, for example

import plotly.graph_objects as go
from plotly.subplots import make_subplots
fig = make_subplots(2,2)
fig.add_trace(go.Histogram2d(
    x = [ 1, 2, 2, 3, 4 ],
    y = [ 1, 2, 2, 3, 4 ],
    #bingroup = 1,
    xbins = {'start':1, 'size':1}), 1,1)
fig.add_trace(go.Histogram2d(
    x = [ 4, 5, 5, 5, 6 ],
    y = [ 4, 5, 5, 5, 6 ],
    #bingroup = 1,
    ybins = {'start': 3, 'size': 1}),1,2)
fig.add_trace(go.Histogram2d(
    x = [ 1, 2, 2, 3, 4 ],
    y = [ 1, 2, 2, 3, 4 ],
    bingroup = 1,
    xbins = {'start':1, 'size':1}), 2,1)
fig.add_trace(go.Histogram2d(
    x = [ 4, 5, 5, 5, 6 ],
    y = [ 4, 5, 5, 5, 6 ],
    bingroup = 1,
    ybins = {'start': 3, 'size': 1}),2,2)
fig.show()

@@ -71,6 +71,30 @@ fig = go.Figure(go.Histogram2d(x=x, y=y, histnorm='probability',
fig.show()
```

### 2D Histogram Share Binning
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sharing bin settings between 2D Histograms

@@ -331,6 +331,28 @@ fig.append_trace(trace5, 3, 2)
fig.show()
```

### Share Binning
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Share bins between histograms

@@ -331,6 +331,28 @@ fig.append_trace(trace5, 3, 2)
fig.show()
```

### Share Binning
In this example both histograms have a compatible bin settings using [bingroup](https://plot.ly/python/reference/#histogram-bingroup) attribute.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add here a comment saying that histograms in the same subplot are forced into the same default to barmode stack, relative or group, but not for overlay?

)
trace4 = go.Histogram(x=x,
trace4 = go.Histogram(x=x,bingroup=1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why you define here a bingroup since the different traces have a different bin size. Also, please remove all the autobinx and autobiny from this tutorial since these parameters are described as obsolete in the doc.

@emmanuelle
Copy link
Contributor

Thanks @Mahdis-z I left a couple of comments.

fig.add_trace(go.Histogram2d(
x = [ 1, 2, 2, 3, 4 ],
y = [ 1, 2, 2, 3, 4 ],
#bingroup = 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the commented lines, it was just me doing some trial and error but these should not appear

@@ -331,6 +327,28 @@ fig.append_trace(trace5, 3, 2)
fig.show()
```

### Share bins between histograms
In this example both histograms have a compatible bin settings using [bingroup](https://plot.ly/python/reference/#histogram-bingroup) attribute. Note that traces on the same subplot, and with the same `barmode` ("stack", "relative", "group") are forced into the same `bingroup`, however traces with `barmode = "overlay"` and on different axes (of the same axis type) can have compatible bin settings. Histogram and [histogram2d](https://plot.ly/python/2D-Histogram/) trace can share the same `bingroup`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence was not completely clear to me, I would say "however traces with barmode = "overlay" or on different axes can different bin settings".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see plotly/plotly.js#3515 (comment) for a better understanding of what compatible means here.

@emmanuelle
Copy link
Contributor

💃 once two very minor comments are addressed (no need to review again)

@nicolaskruchten
Copy link
Contributor

Can we port this PR to the plotly.py repo please? :)

@Mahdis-z Mahdis-z closed this Dec 3, 2019
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.

3 participants