Skip to content

Commit 64f4cf9

Browse files
committed
PEP-8'ed _iplot_html and removed commented out code
1 parent 756cfff commit 64f4cf9

File tree

1 file changed

+28
-43
lines changed

1 file changed

+28
-43
lines changed

plotly/offline/offline.py

Lines changed: 28 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -187,35 +187,30 @@ def _plot_html(figure_or_data, config, validate, default_width,
187187
jlayout = json.dumps(figure.get('layout', {}), cls=utils.PlotlyJSONEncoder)
188188

189189
configkeys = (
190-
'editable',
191-
'autosizable',
192-
'fillFrame',
193-
'frameMargins',
194-
'scrollZoom',
195-
'doubleClick',
196-
'showTips',
197-
'showLink',
198-
'sendData',
199-
'linkText',
200-
'showSources',
201-
'displayModeBar',
202-
'modeBarButtonsToRemove',
203-
'modeBarButtonsToAdd',
204-
'modeBarButtons',
205-
'displaylogo',
206-
'plotGlPixelRatio',
207-
'setBackground',
208-
'topojsonURL')
209-
210-
config_clean = dict((k,config[k]) for k in configkeys if k in config)
190+
'editable',
191+
'autosizable',
192+
'fillFrame',
193+
'frameMargins',
194+
'scrollZoom',
195+
'doubleClick',
196+
'showTips',
197+
'showLink',
198+
'sendData',
199+
'linkText',
200+
'showSources',
201+
'displayModeBar',
202+
'modeBarButtonsToRemove',
203+
'modeBarButtonsToAdd',
204+
'modeBarButtons',
205+
'displaylogo',
206+
'plotGlPixelRatio',
207+
'setBackground',
208+
'topojsonURL'
209+
)
211210

212-
jconfig = json.dumps(config_clean)
211+
config_clean = dict((k, config[k]) for k in configkeys if k in config)
213212

214-
#config = {}
215-
#config['showLink'] = show_link
216-
#config['linkText'] = link_text
217-
#jconfig = json.dumps(config)
218-
#print jconfig
213+
jconfig = json.dumps(config_clean)
219214

220215
# TODO: The get_config 'source of truth' should
221216
# really be somewhere other than plotly.plotly
@@ -314,19 +309,9 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
314309
if not tools._ipython_imported:
315310
raise ImportError('`iplot` can only run inside an IPython Notebook.')
316311

317-
#plot_html, plotdivid, width, height = _plot_html(
318-
# figure_or_data, show_link, link_text, validate,
319-
# '100%', 525, global_requirejs=True)
320-
321312
plot_html, plotdivid, width, height = _plot_html(
322-
figure_or_data=figure_or_data,
323-
config={},
324-
#show_link,
325-
#link_text,
326-
validate=validate,
327-
default_width='100%',
328-
default_height=525,
329-
global_requirejs=True)
313+
figure_or_data, {}, validate, '100%', 525, True
314+
)
330315

331316
display(HTML(plot_html))
332317

@@ -337,10 +322,10 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
337322
)
338323
# if image is given, and is a valid format, we will download the image
339324
script = get_image_download_script('iplot').format(format=image,
340-
width=image_width,
341-
height=image_height,
342-
filename=filename,
343-
plot_id=plotdivid)
325+
width=image_width,
326+
height=image_height,
327+
filename=filename,
328+
plot_id=plotdivid)
344329
# allow time for the plot to draw
345330
time.sleep(1)
346331
# inject code to download an image of the plot

0 commit comments

Comments
 (0)