9
9
import os
10
10
import uuid
11
11
import warnings
12
- from pkg_resources import resource_string
13
12
import webbrowser
14
13
14
+ from pkg_resources import resource_string
15
+
16
+
15
17
import plotly
16
18
from plotly import tools , utils
17
19
from plotly .exceptions import PlotlyError
@@ -98,25 +100,25 @@ def _plot_html(figure_or_data, config,
98
100
jlayout = json .dumps (figure .get ('layout' , {}), cls = utils .PlotlyJSONEncoder )
99
101
100
102
configkeys = (
101
- 'editable' ,
102
- 'autosizable' ,
103
- 'fillFrame' ,
104
- 'frameMargins' ,
105
- 'scrollZoom' ,
106
- 'doubleClick' ,
107
- 'showTips' ,
108
- 'showLink' ,
109
- 'sendData' ,
110
- 'linkText' ,
111
- 'showSources' ,
112
- 'displayModeBar' ,
113
- 'modeBarButtonsToRemove' ,
114
- 'modeBarButtonsToAdd' ,
115
- 'modeBarButtons' ,
116
- 'displaylogo' ,
117
- 'plotGlPixelRatio' ,
118
- 'setBackground' ,
119
- 'topojsonURL' )
103
+ 'editable' ,
104
+ 'autosizable' ,
105
+ 'fillFrame' ,
106
+ 'frameMargins' ,
107
+ 'scrollZoom' ,
108
+ 'doubleClick' ,
109
+ 'showTips' ,
110
+ 'showLink' ,
111
+ 'sendData' ,
112
+ 'linkText' ,
113
+ 'showSources' ,
114
+ 'displayModeBar' ,
115
+ 'modeBarButtonsToRemove' ,
116
+ 'modeBarButtonsToAdd' ,
117
+ 'modeBarButtons' ,
118
+ 'displaylogo' ,
119
+ 'plotGlPixelRatio' ,
120
+ 'setBackground' ,
121
+ 'topojsonURL' )
120
122
121
123
config_clean = dict ((k ,config [k ]) for k in configkeys if k in config )
122
124
@@ -159,7 +161,7 @@ def _plot_html(figure_or_data, config,
159
161
return plotly_html_div , plotdivid , width , height
160
162
161
163
162
- def iplot (figure_or_data , config = {'showLink' : True , 'linkText' : 'Export to plot.ly' },
164
+ def iplot (figure_or_data , config = {'showLink' : True , 'linkText' : 'Export to plot.ly' },
163
165
validate = True ):
164
166
"""
165
167
Draw plotly graphs inside an IPython notebook without
@@ -406,8 +408,8 @@ def plot_mpl(mpl_fig, resize=False, strip_style=False,
406
408
include_plotlyjs , filename , auto_open )
407
409
408
410
409
- def iplot_mpl (mpl_fig , resize = False , strip_style = False ,
410
- verbose = False , config = {'showLink' :True , 'linkText' :'Export to plot.ly' },
411
+ def iplot_mpl (mpl_fig , resize = False , strip_style = False , verbose = False ,
412
+ config = {'showLink' : True , 'linkText' : 'Export to plot.ly' },
411
413
validate = True ):
412
414
"""
413
415
Convert a matplotlib figure to a plotly graph and plot inside an IPython
@@ -494,5 +496,4 @@ def enable_mpl_offline(resize=False, strip_style=False,
494
496
formatter = ip .display_formatter .formatters ['text/html' ]
495
497
formatter .for_type (matplotlib .figure .Figure ,
496
498
lambda fig : iplot_mpl (fig , resize , strip_style , verbose ,
497
- config , validate ))
498
-
499
+ config , validate ))
0 commit comments