Skip to content

emptying Lines data breaks figure #1614

Closed

Description

@kecnry

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.

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