Skip to content

Using update to initialize an empty array property fails #1072

Closed
@jonmmease

Description

@jonmmease

From #1050

Looks like there's a little more to this one - I also can't use update for layout.shapes even with Plotly 3.1.0. The following code prints an empty tuple.

import plotly.graph_objs as go
layout = go.Layout()
shapes = [
    # Line Vertical
    {
        'type': 'line',
        'x0': 1,
        'y0': 0,
        'x1': 1,
        'y1': 2,
        'line': {
            'color': 'rgb(55, 128, 191)',
            'width': 3,
        },
    },
    # Line Horizontal
    {
        'type': 'line',
        'x0': 2,
        'y0': 2,
        'x1': 5,
        'y1': 2,
        'line': {
            'color': 'rgb(50, 171, 96)',
            'width': 4,
            'dash': 'dashdot',
        },
    },
    # Line Diagonal
    {
        'type': 'line',
        'x0': 4,
        'y0': 0,
        'x1': 6,
        'y1': 2,
        'line': {
            'color': 'rgb(128, 0, 128)',
            'width': 4,
            'dash': 'dot',
        },
    },
]
layout.update(shapes=shapes)
print(layout.shapes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions