Create a plotly graph locally as an HTML document or string. Example: ``` from plotly.offline import plot import plotly.graph_objs as go plot([go.Scatter(x=[1, 2, 3], y=[3, 2, 6])], filename='my-graph.html') # We can also download an image of the plot by setting the image p
(
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,
auto_play=True,
animation_opts=None,
)
| 398 | |
| 399 | |
| 400 | def plot( |
| 401 | figure_or_data, |
| 402 | show_link=False, |
| 403 | link_text="Export to plot.ly", |
| 404 | validate=True, |
| 405 | output_type="file", |
| 406 | include_plotlyjs=True, |
| 407 | filename="temp-plot.html", |
| 408 | auto_open=True, |
| 409 | image=None, |
| 410 | image_filename="plot_image", |
| 411 | image_width=800, |
| 412 | image_height=600, |
| 413 | config=None, |
| 414 | include_mathjax=False, |
| 415 | auto_play=True, |
| 416 | animation_opts=None, |
| 417 | ): |
| 418 | """Create a plotly graph locally as an HTML document or string. |
| 419 | |
| 420 | Example: |
| 421 | ``` |
| 422 | from plotly.offline import plot |
| 423 | import plotly.graph_objs as go |
| 424 | |
| 425 | plot([go.Scatter(x=[1, 2, 3], y=[3, 2, 6])], filename='my-graph.html') |
| 426 | # We can also download an image of the plot by setting the image parameter |
| 427 | # to the image format we want |
| 428 | plot([go.Scatter(x=[1, 2, 3], y=[3, 2, 6])], filename='my-graph.html', |
| 429 | image='jpeg') |
| 430 | ``` |
| 431 | More examples below. |
| 432 | |
| 433 | figure_or_data -- a plotly.graph_objs.Figure or plotly.graph_objs.Data or |
| 434 | dict or list that describes a Plotly graph. |
| 435 | See https://plot.ly/python/ for examples of |
| 436 | graph descriptions. |
| 437 | |
| 438 | Keyword arguments: |
| 439 | show_link (default=False) -- display a link in the bottom-right corner of |
| 440 | of the chart that will export the chart to Plotly Cloud or |
| 441 | Plotly Enterprise |
| 442 | link_text (default='Export to plot.ly') -- the text of export link |
| 443 | validate (default=True) -- validate that all of the keys in the figure |
| 444 | are valid? omit if your version of plotly.js has become outdated |
| 445 | with your version of graph_reference.json or if you need to include |
| 446 | extra, unnecessary keys in your figure. |
| 447 | output_type ('file' | 'div' - default 'file') -- if 'file', then |
| 448 | the graph is saved as a standalone HTML file and `plot` |
| 449 | returns None. |
| 450 | If 'div', then `plot` returns a string that just contains the |
| 451 | HTML <div> that contains the graph and the script to generate the |
| 452 | graph. |
| 453 | Use 'file' if you want to save and view a single graph at a time |
| 454 | in a standalone HTML file. |
| 455 | Use 'div' if you are embedding these graphs in an HTML file with |
| 456 | other graphs or HTML markup, like an HTML report or a website. |
| 457 | include_plotlyjs (True | False | 'cdn' | 'directory' | path - default=True) |
no test coverage detected