Skip to content

initializing Bins with bins=1 breaks figure #1622

Open

Description

@kecnry

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions