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

Figure.update() misbehaviour in Python 2 #1462

Closed
nicolaskruchten opened this issue Mar 12, 2019 · 0 comments
Closed

Figure.update() misbehaviour in Python 2 #1462

nicolaskruchten opened this issue Mar 12, 2019 · 0 comments
Labels
bug something broken

Comments

@nicolaskruchten
Copy link
Contributor

Consider the following code:

import plotly.graph_objs as go

def make_fig():
    return go.Figure(data=[
        go.Scatter(x=[1,2],y=[1,2], xaxis='x'), 
        go.Scatter(x=[2,3],y=[2,3], xaxis='x2')
    ])

fig = make_fig().update(layout= {
    'grid': {'xaxes': ['x', 'x2'], 'yaxes': ['y']}, 
    'xaxis': {'title': 'total_bill'}, 
    'xaxis2': {'matches': 'x', 'title': 'total_bill'}
})
print(fig.layout.xaxis2)

fig = make_fig().update(layout= {
    'grid': {'xaxes': ['x', 'x2'], 'yaxes': ['y'], 'yside': 'left', 'ygap': 0.1, 'xside': 'bottom'}, 
    'xaxis': {'title': 'total_bill'}, 
    'xaxis2': {'matches': 'x', 'title': 'total_bill'}
})
print(fig.layout.xaxis2)

In Python 3.6/plotly 3.7.0 it prints, as expected:

layout.XAxis({
    'matches': 'x', 'title': {'text': 'total_bill'}
})
layout.XAxis({
    'matches': 'x', 'title': {'text': 'total_bill'}
})

but in Python 2.7/plotly 3.7.0 it prints:

layout.XAxis({
    'matches': 'x'
})
layout.XAxis()

Note that the title didn't get set on the top one, and the matches didn't get set on the second one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

2 participants