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

emptying Lines data breaks figure #1614

Closed
kecnry opened this issue Jul 13, 2023 · 0 comments
Closed

emptying Lines data breaks figure #1614

kecnry opened this issue Jul 13, 2023 · 0 comments

Comments

@kecnry
Copy link

kecnry commented Jul 13, 2023

Describe the bug
Emptying the x/y data in a Lines instance clears the mark, as expected, but future updates fail to update on the figure

To Reproduce

import bqplot
import numpy as np

x = np.linspace(0,1,11)
y = x**2

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

line = bqplot.Lines(scales={'x': fig.axes[0].scale,
                            'y': fig.axes[1].scale},
                    x=x, y=y,
                    colors=['gray'], size=12)

fig.marks = fig.marks + [line]

fig

(displays as expected)

line.x, line.y = [], []

(clears plot as expected, no errors, but without this line the next line would work as expected)

line.x, line.y = x, 2*x

(plot does not update and remains blank - although grid lines do reappear, the following error appears in the JS console)

Error setting state: invalid format: .undefinedg

Expected behavior
Line should re-appear after setting to be non-empty array.

maartenbreddels added a commit to maartenbreddels/bqplot that referenced this issue Jul 25, 2023
Fixes bqplot#1614

If no data is present, a scale has a domain of (0, 1) but if we
remove the data (set it to an empty array) afterwards, we set it
to (-inf, +inf) which causes rendering issues and make the bqplot
figure unable to restore itself.
It is more consistent to behave like no data was passed in, and use
(0, 1) for the domain.
martinRenou added a commit that referenced this issue Jul 26, 2023
* fix: set domain to (0, 1) when no data is present

Fixes #1614

If no data is present, a scale has a domain of (0, 1) but if we
remove the data (set it to an empty array) afterwards, we set it
to (-inf, +inf) which causes rendering issues and make the bqplot
figure unable to restore itself.
It is more consistent to behave like no data was passed in, and use
(0, 1) for the domain.

* Update snapshots

---------

Co-authored-by: martinRenou <martin.renou@gmail.com>
martinRenou pushed a commit to martinRenou/bqplot that referenced this issue Jul 27, 2023
Fixes bqplot#1614

If no data is present, a scale has a domain of (0, 1) but if we
remove the data (set it to an empty array) afterwards, we set it
to (-inf, +inf) which causes rendering issues and make the bqplot
figure unable to restore itself.
It is more consistent to behave like no data was passed in, and use
(0, 1) for the domain.
martinRenou pushed a commit to martinRenou/bqplot that referenced this issue Jul 27, 2023
Fixes bqplot#1614

If no data is present, a scale has a domain of (0, 1) but if we
remove the data (set it to an empty array) afterwards, we set it
to (-inf, +inf) which causes rendering issues and make the bqplot
figure unable to restore itself.
It is more consistent to behave like no data was passed in, and use
(0, 1) for the domain.
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