Skip to content

Commit d447ae4

Browse files
committed
add download image examples, update more default values
1 parent 4256891 commit d447ae4

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

plotly/offline/offline.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
225225
from plotly.offline import init_notebook_mode, iplot
226226
init_notebook_mode()
227227
iplot([{'x': [1, 2, 3], 'y': [5, 2, 7]}])
228+
# We can also download an image of the plot by setting `image=True`
229+
iplot([{'x': [1, 2, 3], 'y': [5, 2, 7]}], image=True)
228230
```
229231
"""
230232
if not __PLOTLY_OFFLINE_INITIALIZED:
@@ -286,6 +288,9 @@ def plot(figure_or_data,
286288
import plotly.graph_objs as go
287289
288290
plot([go.Scatter(x=[1, 2, 3], y=[3, 2, 6])], filename='my-graph.html')
291+
# We can also download an image of the plot by setting `image=True`
292+
plot([go.Scatter(x=[1, 2, 3], y=[3, 2, 6])], filename='my-graph.html'
293+
image=True)
289294
```
290295
More examples below.
291296
@@ -536,12 +541,12 @@ def iplot_mpl(mpl_fig, resize=False, strip_style=False,
536541
has become outdated with your version of
537542
graph_reference.json or if you need to include
538543
extra, unnecessary keys in your figure.
539-
downloage_image (default=False) -- If True, the image of the current plot
540-
will be downloaded.
544+
image (default=False) -- If True, the image of the current plot will be
545+
downloaded.
541546
_format (default='png') -- Specifies the format of the image to be
542547
downloaded if `downlowad_image` is True.
543-
image_filename (default='plot_image') -- Sets the name of the file your image
544-
will be saved to. The extension should not be included.
548+
image_filename (default='plot_image') -- Sets the name of the file your
549+
image will be saved to. The extension should not be included.
545550
_height (default=600) -- Specifies the height of the image in `px`.
546551
_width (default=800) -- Specifies the width of the image in `px`.
547552
@@ -616,7 +621,7 @@ def download_notebook_image(format='png', height=600, width=800,
616621
height -- sets the height of the image in px (default=600)
617622
width -- sets the width of the image in px (default=800)
618623
filename -- the name of the saved file without format extension
619-
(default='newplot')
624+
(default='plot_image')
620625
"""
621626
script = ('<script>'
622627
'function downloadimage(format, height, width,'

0 commit comments

Comments
 (0)