@@ -126,13 +126,15 @@ def _plot_html(figure_or_data, config,
126
126
# really be somewhere other than plotly.plotly
127
127
plotly_platform_url = plotly .plotly .get_config ().get ('plotly_domain' ,
128
128
'https://plot.ly' )
129
+
129
130
if (plotly_platform_url != 'https://plot.ly' and
130
- link_text == 'Export to plot.ly' ):
131
+ 'linkText' in config ):
131
132
132
133
link_domain = plotly_platform_url \
133
134
.replace ('https://' , '' )\
134
135
.replace ('http://' , '' )
135
- link_text = link_text .replace ('plot.ly' , link_domain )
136
+
137
+ config ['linkText' ] = config ['linkText' ].replace ('plot.ly' , link_domain )
136
138
137
139
script = 'Plotly.newPlot("{id}", {data}, {layout}, {config})' .format (
138
140
id = plotdivid ,
@@ -157,7 +159,7 @@ def _plot_html(figure_or_data, config,
157
159
return plotly_html_div , plotdivid , width , height
158
160
159
161
160
- def iplot (figure_or_data , config = {'show_link ' : True , 'link_text ' : 'Export to plot.ly' },
162
+ def iplot (figure_or_data , config = {'showLink ' : True , 'linkText ' : 'Export to plot.ly' },
161
163
validate = True ):
162
164
"""
163
165
Draw plotly graphs inside an IPython notebook without
@@ -172,10 +174,12 @@ def iplot(figure_or_data, config = {'show_link': True, 'link_text': 'Export to p
172
174
graph descriptions.
173
175
174
176
Keyword arguments:
175
- show_link (default=True) -- display a link in the bottom-right corner of
176
- of the chart that will export the chart to
177
- Plotly Cloud or Plotly Enterprise
178
- link_text (default='Export to plot.ly') -- the text of export link
177
+ config -- a dictionary with configuration attributes for the plot,
178
+ default contains the following two elements:
179
+ showLink (default=True) -- display a link in the bottom-right corner of
180
+ of the chart that will export the chart to
181
+ Plotly Cloud or Plotly Enterprise
182
+ linkText (default='Export to plot.ly') -- the text of export link
179
183
validate (default=True) -- validate that all of the keys in the figure
180
184
are valid? omit if your version of plotly.js
181
185
has become outdated with your version of
@@ -211,7 +215,7 @@ def iplot(figure_or_data, config = {'show_link': True, 'link_text': 'Export to p
211
215
display (HTML (plot_html ))
212
216
213
217
214
- def plot (figure_or_data , config = {'show_link ' :True , 'link_text ' :'Export to plot.ly' },
218
+ def plot (figure_or_data , config = {'showLink ' :True , 'linkText ' :'Export to plot.ly' },
215
219
validate = True , output_type = 'file' ,
216
220
include_plotlyjs = True ,
217
221
filename = 'temp-plot.html' ,
@@ -233,10 +237,12 @@ def plot(figure_or_data, config = {'show_link':True, 'link_text':'Export to plot
233
237
graph descriptions.
234
238
235
239
Keyword arguments:
236
- show_link (default=True) -- display a link in the bottom-right corner of
237
- of the chart that will export the chart to Plotly Cloud or
238
- Plotly Enterprise
239
- link_text (default='Export to plot.ly') -- the text of export link
240
+ config -- a dictionary with configuration attributes for the plot,
241
+ default contains the following two elements:
242
+ showLink (default=True) -- display a link in the bottom-right corner of
243
+ of the chart that will export the chart to Plotly Cloud or
244
+ Plotly Enterprise
245
+ linkText (default='Export to plot.ly') -- the text of export link
240
246
validate (default=True) -- validate that all of the keys in the figure
241
247
are valid? omit if your version of plotly.js has become outdated
242
248
with your version of graph_reference.json or if you need to include
@@ -331,7 +337,7 @@ def plot(figure_or_data, config = {'show_link':True, 'link_text':'Export to plot
331
337
332
338
333
339
def plot_mpl (mpl_fig , resize = False , strip_style = False ,
334
- verbose = False , config = {'show_link ' :True , 'link_text ' :'Export to plot.ly' },
340
+ verbose = False , config = {'showLink ' :True , 'linkText ' :'Export to plot.ly' },
335
341
validate = True , output_type = 'file' , include_plotlyjs = True ,
336
342
filename = 'temp-plot.html' , auto_open = True ):
337
343
"""
@@ -349,10 +355,12 @@ def plot_mpl(mpl_fig, resize=False, strip_style=False,
349
355
resize (default=False) -- allow plotly to choose the figure size.
350
356
strip_style (default=False) -- allow plotly to choose style options.
351
357
verbose (default=False) -- print message.
352
- show_link (default=True) -- display a link in the bottom-right corner of
353
- of the chart that will export the chart to Plotly Cloud or
354
- Plotly Enterprise
355
- link_text (default='Export to plot.ly') -- the text of export link
358
+ config -- a dictionary with configuration attributes for the plot,
359
+ default contains the following two elements:
360
+ showLink (default=True) -- display a link in the bottom-right corner of
361
+ of the chart that will export the chart to Plotly Cloud or
362
+ Plotly Enterprise
363
+ linkText (default='Export to plot.ly') -- the text of export link
356
364
validate (default=True) -- validate that all of the keys in the figure
357
365
are valid? omit if your version of plotly.js has become outdated
358
366
with your version of graph_reference.json or if you need to include
@@ -399,7 +407,7 @@ def plot_mpl(mpl_fig, resize=False, strip_style=False,
399
407
400
408
401
409
def iplot_mpl (mpl_fig , resize = False , strip_style = False ,
402
- verbose = False , config = {'show_link ' :True , 'link_text ' :'Export to plot.ly' },
410
+ verbose = False , config = {'showLink ' :True , 'linkText ' :'Export to plot.ly' },
403
411
validate = True ):
404
412
"""
405
413
Convert a matplotlib figure to a plotly graph and plot inside an IPython
@@ -420,13 +428,12 @@ def iplot_mpl(mpl_fig, resize=False, strip_style=False,
420
428
resize (default=False) -- allow plotly to choose the figure size.
421
429
strip_style (default=False) -- allow plotly to choose style options.
422
430
verbose (default=False) -- print message.
423
- show_link (default=True) -- display a link in the bottom-right corner of
424
- of the chart that will export the chart to Plotly Cloud or
425
- Plotly Enterprise
426
- show_link (default=True) -- display a link in the bottom-right corner of
427
- of the chart that will export the chart to
428
- Plotly Cloud or Plotly Enterprise
429
- link_text (default='Export to plot.ly') -- the text of export link
431
+ config -- a dictionary with configuration attributes for the plot,
432
+ default contains the following two elements:
433
+ showLink (default=True) -- display a link in the bottom-right corner of
434
+ of the chart that will export the chart to
435
+ Plotly Cloud or Plotly Enterprise
436
+ linkText (default='Export to plot.ly') -- the text of export link
430
437
validate (default=True) -- validate that all of the keys in the figure
431
438
are valid? omit if your version of plotly.js
432
439
has become outdated with your version of
@@ -453,8 +460,8 @@ def iplot_mpl(mpl_fig, resize=False, strip_style=False,
453
460
454
461
455
462
def enable_mpl_offline (resize = False , strip_style = False ,
456
- verbose = False , show_link = True ,
457
- link_text = 'Export to plot.ly' , validate = True ):
463
+ verbose = False , config = { 'showLink' : True , 'linkText' : 'Export to plot.ly' } ,
464
+ validate = True ):
458
465
"""
459
466
Convert mpl plots to locally hosted HTML documents.
460
467
@@ -487,5 +494,5 @@ def enable_mpl_offline(resize=False, strip_style=False,
487
494
formatter = ip .display_formatter .formatters ['text/html' ]
488
495
formatter .for_type (matplotlib .figure .Figure ,
489
496
lambda fig : iplot_mpl (fig , resize , strip_style , verbose ,
490
- show_link , link_text , validate ))
497
+ config , validate ))
491
498
0 commit comments