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

initializing Bins with bins=1 breaks figure #1622

Open
kecnry opened this issue Jul 28, 2023 · 0 comments
Open

initializing Bins with bins=1 breaks figure #1622

kecnry opened this issue Jul 28, 2023 · 0 comments

Comments

@kecnry
Copy link

kecnry commented Jul 28, 2023

Describe the bug
Similar to #1614, initializing a Bins mark with bins=1 breaks the figure (although oddly a resize event seems to resuscitate it).

To Reproduce

import bqplot

fig = bqplot.Figure()
fig.axes = [bqplot.Axis(scale=bqplot.LinearScale(), label='x'),
            bqplot.Axis(scale=bqplot.LinearScale(), orientation='vertical', label='y')]

orig_bins = 1  # breaks figure
orig_bins = 2  # does NOT break figure

bins = bqplot.Bins(scales={'x': fig.axes[0].scale,
                            'y': fig.axes[1].scale},
                    sample=[0, 1, 2, 3], bins=orig_bins,
                    colors=['gray'], size=12)

fig.marks = [bins]

fig

and then later, revising the sample/bins:

bins.sample = np.random.random(20)
bins.bins = 10

if orig_bins != 1, the figure updates as expected. If orig_bins == 1, there do seem to be some updates, but the figure is not correct until the widget is resized.

with orig_bins = 1 and then updating bins.sample and bins.bins:
image

after resizing the figure:

Screen Shot 2023-07-28 at 3 11 05 PM
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

No branches or pull requests

1 participant