Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6723236

Browse filesBrowse files
committed
docstring 🐶
1 parent 962c881 commit 6723236
Copy full SHA for 6723236

File tree

1 file changed

+26
-4
lines changed
Filter options

1 file changed

+26
-4
lines changed

‎plotly/offline.py

Copy file name to clipboardExpand all lines: plotly/offline.py
+26-4Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,28 @@ def download_plotlyjs(download_url):
3737
'code to make your first offline graph:',
3838
'',
3939
'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',
4142
'plotly.offline.iplot([{"x": [1, 2, 3], "y": [3, 1, 6]}])'
4243
]))
4344

4445

4546
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+
"""
4753
from IPython.display import HTML, display
4854

4955
if not os.path.exists(PLOTLY_OFFLINE_BUNDLE):
5056
raise Exception('Plotly Offline source file at {source_path} '
5157
'is not found.\n'
5258
'If you have a Plotly Offline license, then try '
53-
'running plotly.offline.configure_offline(url) '
59+
'running plotly.offline.download_plotlyjs(url) '
5460
'with a licensed download url.\n'
55-
"Don't have a Plotly Offline license?"
61+
"Don't have a Plotly Offline license? "
5662
'Contact sales@plot.ly learn more about licensing.\n'
5763
'Questions? support@plot.ly.'
5864
.format(source_path=PLOTLY_OFFLINE_BUNDLE))
@@ -65,6 +71,22 @@ def init_notebook_mode():
6571

6672
def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly'):
6773
"""
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
6890
"""
6991
if not __PLOTLY_OFFLINE_INITIALIZED:
7092
raise exceptions.PlotlyError('\n'.join([

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.