Skip to content

Ensure plot sends layout along. #666

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

Merged
merged 1 commit into from
Jan 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plotly/plotly/plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ def plot(figure_or_data, validate=True, **plot_options):

fig = tools._replace_newline(figure) # does not mutate figure
data = fig.get('data', [])
plot_options['layout'] = fig.get('layout', {})
response = v1.clientresp(data, **plot_options)

# Check if the url needs a secret key
Expand Down
9 changes: 7 additions & 2 deletions plotly/tests/test_core/test_plotly/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ def test_plot_valid(self):
'x': [1, 2, 3],
'y': [2, 1, 2]
}
]
],
'layout': {'title': 'simple'}
}
py.plot(fig, auto_open=False, filename='plot_valid')
url = py.plot(fig, auto_open=False, filename='plot_valid')
saved_fig = py.get_figure(url)
self.assertEqual(saved_fig['data'][0]['x'], fig['data'][0]['x'])
self.assertEqual(saved_fig['data'][0]['y'], fig['data'][0]['y'])
self.assertEqual(saved_fig['layout']['title'], fig['layout']['title'])

@raises(PlotlyError)
def test_plot_invalid(self):
Expand Down