Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent plotly from plotting automatically

Tags:

python

plotly

I just discovered plotly and like it so far. I have this code provided by the main website

import plotly.plotly as py
from plotly.graph_objs import *

trace0 = Scatter(
    x=[1,2,3,4],
    y=[10,15,13,17]
)
trace1 = Scatter(
    x=[1,2,3,4],
    y=[16,5,11,9]
)
data = Data([trace0, trace1])

unique_url = py.plot(data, filename='basic-line')

I am curious about two things:

1) When I run this code, my browser automatically pops up and shows me the graph. All I want is the url so that I can later embed it in an html file. Is there a way to turn off the feature that opens my browser and shows me the graph?

2) Is there a way to get rid of the 'Play with this data' link?

I have combed through the documentation provided, but have come up empty-handed on these two issues.

like image 752
Matt Cremeens Avatar asked Apr 08 '15 19:04

Matt Cremeens


People also ask

How do you remove Plotly in Python?

Create a plot and return the url to see the file id which will be used to delete the plot. Include the file id in your request. The following request moves the plot from the organize folder into the trash. Note: a successful trash request will return a Response [200] .

What is Plotly offline mode?

Starting with this version, the only supported mode of operation in the plotly package is “offline” mode, which requires no internet connection, no account, no authentication tokens, and no payment of any kind. Support for “online” mode has been moved into a separately-installed package called chart-studio .

Is Plotly or Matplotlib better?

Matplotlib is also a great place for new Python users to start their data visualization education, because each plot element is declared explicitly in a logical manner. Plotly, on the other hand, is a more sophisticated data visualization tool that is better suited for creating elaborate plots more efficiently.

How to set the configuration options of figures using Plotly?

How to set the configuration options of figures using the Plotly Python graphing library. New to Plotly? The .show () method that you use to display your figures also accepts a config parameter. You can set the configuration options for your figure by passing a dictionary to this parameter which contains the options you want to set.

What is Plotly used for?

Built on top of the Plotly JavaScript library ( plotly.js ), plotly enables Python users to create beautiful interactive web-based visualizations that can be displayed in Jupyter notebooks, saved to standalone HTML files, or served as part of pure Python-built web applications using Dash.

Can I use Plotly in Python to create a website?

For information on using Python to build web applications containing plotly figures, see the Dash User Guide. We also encourage you to join the Plotly Community Forum if you want help with anything related to plotly. This package contains everything you need to write figures to standalone HTML files.

How do I reduce the overlap between bar plots and title?

The Below Code produces an Output Figure, where the Title overlaps with the Bar plots. There are multiple ways where we can reduce this manually, like Increasing the Figure size or Decreasing the Title Text size .


1 Answers

To disable pop-ups you could use auto_open=FALSE and try the following

py.plot(data, filename='basic_line', auto_open=False)
like image 56
Daniel Robertson Avatar answered Sep 21 '22 20:09

Daniel Robertson