@@ -275,7 +275,7 @@ def _plot_html(figure_or_data, config, validate, default_width,
275275
276276def iplot (figure_or_data , show_link = True , link_text = 'Export to plot.ly' ,
277277 validate = True , image = None , filename = 'plot_image' , image_width = 800 ,
278- image_height = 600 ):
278+ image_height = 600 , config = None ):
279279 """
280280 Draw plotly graphs inside an IPython or Jupyter notebook without
281281 connecting to an external server.
@@ -308,6 +308,9 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
308308 will be saved to. The extension should not be included.
309309 image_height (default=600) -- Specifies the height of the image in `px`.
310310 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.
311314
312315 Example:
313316 ```
@@ -331,9 +334,9 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
331334 if not ipython :
332335 raise ImportError ('`iplot` can only run inside an IPython Notebook.' )
333336
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 )
337340
338341 plot_html , plotdivid , width , height = _plot_html (
339342 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',
375378def plot (figure_or_data , show_link = True , link_text = 'Export to plot.ly' ,
376379 validate = True , output_type = 'file' , include_plotlyjs = True ,
377380 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 ):
379383 """ Create a plotly graph locally as an HTML document or string.
380384
381385 Example:
@@ -435,6 +439,9 @@ def plot(figure_or_data, show_link=True, link_text='Export to plot.ly',
435439 image will be saved to. The extension should not be included.
436440 image_height (default=600) -- Specifies the height of the image in `px`.
437441 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.
438445 """
439446 if output_type not in ['div' , 'file' ]:
440447 raise ValueError (
@@ -446,9 +453,9 @@ def plot(figure_or_data, show_link=True, link_text='Export to plot.ly',
446453 "Adding .html to the end of your file." )
447454 filename += '.html'
448455
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 )
452459
453460 plot_html , plotdivid , width , height = _plot_html (
454461 figure_or_data , config , validate ,
0 commit comments