Skip to content

Commit 1892ab6

Browse files
committed
rename some arguments, typos, and formatting
1 parent 5bf4dd5 commit 1892ab6

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

plotly/offline/offline.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
__PLOTLY_OFFLINE_INITIALIZED = False
3333

34-
__IMAGE_FORMATS = ['jpeg', 'svg', 'webp', 'svg']
34+
__IMAGE_FORMATS = ['jpeg', 'png', 'webp', 'svg']
3535

3636

3737
def download_plotlyjs(download_url):
@@ -251,8 +251,10 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
251251

252252
if image:
253253
if image not in __IMAGE_FORMATS:
254-
raise ValueError('The image parameter takes only the following'
255-
'format types: `png`, `jpeg`, `webp`, `svg`')
254+
raise ValueError(''.join(['The image parameter takes only the'
255+
'following format types: `png`, `jpeg`, `webp`,'
256+
' `svg`']
257+
))
256258
# if the check passes then download script injection will commence.
257259
warnings.warn('For higher resolution images and more export '
258260
'options, consider making requests to the '
@@ -270,12 +272,12 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
270272
'downloadimage(\'{format}\', {height}, {width}, '
271273
'\'{filename}\');}}'
272274
'</script>'
273-
).format(format=format, width=image_width,
275+
).format(format=image, width=image_width,
274276
height=image_height, filename=filename,
275277
plot_id=plotdivid)
276278
# allow time for the plot to draw
277279
import time
278-
time.sleep(0.1)
280+
time.sleep(1)
279281
# inject code to download an image of the plot
280282
display(HTML(script))
281283

@@ -383,7 +385,7 @@ def plot(figure_or_data,
383385

384386
if image:
385387
if image not in __IMAGE_FORMATS:
386-
raise ValueError('The image parameter takes only the
388+
raise ValueError('The image parameter takes only the '
387389
'following format types: `png`, `jpeg`, '
388390
'`webp`, `svg`')
389391
# if the check passes then download script is injected.
@@ -405,7 +407,7 @@ def plot(figure_or_data,
405407
'downloadimage(\'{format}\', {height}, {width}, '
406408
'\'{filename}\');}}'
407409
'</script>'
408-
).format(format=format, width=image_width,
410+
).format(format=image, width=image_width,
409411
height=image_height,
410412
filename=image_filename, plot_id=plotdivid)
411413
else:
@@ -521,8 +523,7 @@ def plot_mpl(mpl_fig, resize=False, strip_style=False,
521523
return plot(plotly_plot, show_link, link_text, validate, output_type,
522524
include_plotlyjs, filename, auto_open,
523525
image=image, image_filename=image_filename,
524-
format=format, image_height=image_height,
525-
image_width=image_width)
526+
image_height=image_height, image_width=image_width)
526527

527528

528529
def iplot_mpl(mpl_fig, resize=False, strip_style=False,

0 commit comments

Comments
 (0)