Skip to content

Incorrect Validation Error for layout.grid.subplots attribute #1220

Closed
@michaelbabyn

Description

@michaelbabyn

I'm getting a validation ValueError when I try to set the layout.grid.subplots attribute. This attribute should accept a 2d list of the enumerated values (see here) but it is being limited to a single dimensional list of one element.

ValueError: 
    Invalid value of type 'builtins.list' received for the 'subplots' property of layout.grid
        Received value: [['xy', 'x2y'], ['xy3', 'x4y4']]

    The 'subplots' property is an info array that may be specified as a
    list or tuple of up to 1 elements where:

(0) The 'subplots[0]' property is an enumeration that may be specified as:
      - One of the following enumeration values:
            ['']
      - A string that matches one of the following regular expressions:
            ['^x([2-9]|[1-9][0-9]+)?y([2-9]|[1-9][0-9]+)?$']

Here is an example demonstrating the problem which works if I use dicts and validate=False

import plotly.offline as py
import plotly.graph_objs as go

py.init_notebook_mode()

trace1 = go.Scatter(
    x=[1, 2, 3],
    y=[2, 3, 4]
)
trace2 = go.Scatter(
    x=[20, 30, 40],
    y=[5, 5, 5],
    xaxis='x2',
    yaxis='y'
)
trace3 = go.Scatter(
    x=[2, 3, 4],
    y=[600, 700, 800],
    xaxis='x',
    yaxis='y3'
)
trace4 = go.Scatter(
    x=[4000, 5000, 6000],
    y=[7000, 8000, 9000],
    xaxis='x4',
    yaxis='y4'
)
data = [trace1, trace2, trace3, trace4]
layout = go.Layout(
    grid = go.layout.Grid(
        rows=2, 
        columns=2,
        subplots=[['xy','x2y'],['xy3','x4y4']], 
        )
    )
fig = go.Figure(data=data, layout=layout)
py.iplot(fig, filename='shared-axes-subplots')

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