How to prevent plotly from plotting automatically

Matt Cremeens picture Matt Cremeens · Apr 8, 2015 · Viewed 11.7k times · Source

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.

Answer

Daniel Robertson picture Daniel Robertson · Apr 8, 2015

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

py.plot(data, filename='basic_line', auto_open=False)