@@ -37,22 +37,28 @@ def download_plotlyjs(download_url):
37
37
'code to make your first offline graph:' ,
38
38
'' ,
39
39
'import plotly' ,
40
- 'plotly.offline.init_notebook_mode() # initialize offline mode' ,
40
+ 'plotly.offline.init_notebook_mode() '
41
+ '# run at the start of every ipython notebook' ,
41
42
'plotly.offline.iplot([{"x": [1, 2, 3], "y": [3, 1, 6]}])'
42
43
]))
43
44
44
45
45
46
def init_notebook_mode ():
46
- # TODO: check if ipython is available...?
47
+ """
48
+ Initialize Plotly Offline mode in an IPython Notebook.
49
+ Run this function at the start of an IPython notebook
50
+ to load the necessary javascript files for creating
51
+ Plotly graphs with plotly.offline.iplot.
52
+ """
47
53
from IPython .display import HTML , display
48
54
49
55
if not os .path .exists (PLOTLY_OFFLINE_BUNDLE ):
50
56
raise Exception ('Plotly Offline source file at {source_path} '
51
57
'is not found.\n '
52
58
'If you have a Plotly Offline license, then try '
53
- 'running plotly.offline.configure_offline (url) '
59
+ 'running plotly.offline.download_plotlyjs (url) '
54
60
'with a licensed download url.\n '
55
- "Don't have a Plotly Offline license?"
61
+ "Don't have a Plotly Offline license? "
56
62
'Contact sales@plot.ly learn more about licensing.\n '
57
63
'Questions? support@plot.ly.'
58
64
.format (source_path = PLOTLY_OFFLINE_BUNDLE ))
@@ -65,6 +71,22 @@ def init_notebook_mode():
65
71
66
72
def iplot (figure_or_data , show_link = True , link_text = 'Export to plot.ly' ):
67
73
"""
74
+ Draw plotly graphs inside an IPython notebook without
75
+ connecting to an external server.
76
+ To save the chart to Plotly Cloud or Plotly Enterprise, use
77
+ `plotly.plotly.iplot`.
78
+ To embed an image of the chart, use `plotly.image.ishow`.
79
+
80
+ figure_or_data -- a plotly.graph_objs.Figure or plotly.graph_objs.Data or
81
+ dict or list that describes a Plotly graph.
82
+ See https://plot.ly/python/ for examples of
83
+ graph descriptions.
84
+
85
+ Keyword arguments:
86
+ show_link (default=True) -- display a link in the bottom-right corner of
87
+ of the chart that will export the chart to
88
+ Plotly Cloud or Plotly Enterprise
89
+ link_text (default='Export to plot.ly') -- the text of export link
68
90
"""
69
91
if not __PLOTLY_OFFLINE_INITIALIZED :
70
92
raise exceptions .PlotlyError ('\n ' .join ([
0 commit comments