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

plot function (from plotly.offline) does not support (open) file handles as target #1419

Closed
s-m-e opened this issue Feb 1, 2019 · 3 comments

Comments

@s-m-e
Copy link

s-m-e commented Feb 1, 2019

Currently, the filename parameter of plot only supports filenames (temp-plot.html is default). It does not support open file handles.

The latter is very useful when writing e.g. command line tools with click (or similar tools), which handles opening files specified by a user on the command line transparently and only provides a file handle to the script.

from plotly.offline import plot
help(plot)

plot(figure_or_data, show_link=False, link_text='Export to plot.ly', validate=True, output_type='file', include_plotlyjs
=True, filename='temp-plot.html', auto_open=True, image=None, image_filename='plot_image', image_width=800, image_height
=600, config=None, include_mathjax=False)
[...]
@s-m-e
Copy link
Author

s-m-e commented Feb 1, 2019

Just looked at the relevant source code - it's fairly easy to add. Would you accept a pull request?

The interesting question then becomes how to handle the stuff between subsequent lines 731 and 744. Ignore auto_open == True and include_plotlyjs == 'directory' options or raise exceptions if filename is an open file handle?

@jonmmease
Copy link
Contributor

Hi @s-m-e, thanks for the suggestion. Yes, and pull request would be appreciated! It's fine to raise exceptions for combinations of parameters that don't make sense together.

In case you're interested in how I'd like to see this API refactored in the future, see #1098.

@gvwilson
Copy link
Contributor

Hi - we are currently trying to tidy up Plotly's public repositories to help us focus our efforts on things that will help users most. Since this issue has been sitting for several years, I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our backlog. Thanks for your help - @gvwilson

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

No branches or pull requests

3 participants