@@ -275,7 +275,7 @@ def _plot_html(figure_or_data, config, validate, default_width,
275
275
276
276
def iplot (figure_or_data , show_link = True , link_text = 'Export to plot.ly' ,
277
277
validate = True , image = None , filename = 'plot_image' , image_width = 800 ,
278
- image_height = 600 ):
278
+ image_height = 600 , config = None ):
279
279
"""
280
280
Draw plotly graphs inside an IPython or Jupyter notebook without
281
281
connecting to an external server.
@@ -308,6 +308,9 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
308
308
will be saved to. The extension should not be included.
309
309
image_height (default=600) -- Specifies the height of the image in `px`.
310
310
image_width (default=800) -- Specifies the width of the image in `px`.
311
+ config (default=None) -- Plot view options dictionary. Keyword arguments
312
+ `show_link` and `link_text` set the associated options in this
313
+ dictionary if it doesn't contain them already.
311
314
312
315
Example:
313
316
```
@@ -331,9 +334,9 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
331
334
if not ipython :
332
335
raise ImportError ('`iplot` can only run inside an IPython Notebook.' )
333
336
334
- config = {}
335
- config [ 'showLink' ] = show_link
336
- config [ 'linkText' ] = link_text
337
+ config = dict ( config ) if config else {}
338
+ config . setdefault ( 'showLink' , show_link )
339
+ config . setdefault ( 'linkText' , link_text )
337
340
338
341
plot_html , plotdivid , width , height = _plot_html (
339
342
figure_or_data , config , validate , '100%' , 525 , True
@@ -375,7 +378,8 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
375
378
def plot (figure_or_data , show_link = True , link_text = 'Export to plot.ly' ,
376
379
validate = True , output_type = 'file' , include_plotlyjs = True ,
377
380
filename = 'temp-plot.html' , auto_open = True , image = None ,
378
- image_filename = 'plot_image' , image_width = 800 , image_height = 600 ):
381
+ image_filename = 'plot_image' , image_width = 800 , image_height = 600 ,
382
+ config = None ):
379
383
""" Create a plotly graph locally as an HTML document or string.
380
384
381
385
Example:
@@ -435,6 +439,9 @@ def plot(figure_or_data, show_link=True, link_text='Export to plot.ly',
435
439
image will be saved to. The extension should not be included.
436
440
image_height (default=600) -- Specifies the height of the image in `px`.
437
441
image_width (default=800) -- Specifies the width of the image in `px`.
442
+ config (default=None) -- Plot view options dictionary. Keyword arguments
443
+ `show_link` and `link_text` set the associated options in this
444
+ dictionary if it doesn't contain them already.
438
445
"""
439
446
if output_type not in ['div' , 'file' ]:
440
447
raise ValueError (
@@ -446,9 +453,9 @@ def plot(figure_or_data, show_link=True, link_text='Export to plot.ly',
446
453
"Adding .html to the end of your file." )
447
454
filename += '.html'
448
455
449
- config = {}
450
- config [ 'showLink' ] = show_link
451
- config [ 'linkText' ] = link_text
456
+ config = dict ( config ) if config else {}
457
+ config . setdefault ( 'showLink' , show_link )
458
+ config . setdefault ( 'linkText' , link_text )
452
459
453
460
plot_html , plotdivid , width , height = _plot_html (
454
461
figure_or_data , config , validate ,
0 commit comments