Skip to content

Multiple axis support in version 3 #1104

@vlizanae

Description

@vlizanae

When I try to add another yaxis to the layout imperatively, the traces in the original yaxis seem to dissapear, here's a minimal example:

fig = go.FigureWidget()

trace1 = go.Bar()
trace1.x = [1, 2, 3, 4]
trace1.y = [1, 2, 3, 4]
trace1.yaxis = 'y1'
fig.add_trace(trace1)

trace2 = go.Scatter()
trace2.x = [1, 2, 3, 4]
trace2.y = [1, 2, 3, 4]
trace2.yaxis = 'y2'
fig.add_trace(trace2)

fig.layout['yaxis2'] = go.layout.YAxis()
fig.layout.yaxis2.side = 'right'

fig

I'm not so comfortable with fig.layout['yaxis2'] = go.layout.YAxis() also, it might be the root of the issue. Maybe a method to add an axis would be nice.
I'm loving version 3 btw.

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