Skip to content

Commit 32f0080

Browse files
author
yankev
committed
fix
1 parent 8740209 commit 32f0080

File tree

3 files changed

+134
-19
lines changed

3 files changed

+134
-19
lines changed

plotly/graph_reference/default-schema.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4405,7 +4405,7 @@
44054405
}
44064406
},
44074407
"colorscale": {
4408-
"description": "Has only an effect if `marker.color` is set to a numerical array. Sets the colorscale.",
4408+
"description": "Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)', [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in color space, use cmin and cmax",
44094409
"role": "style",
44104410
"valType": "colorscale"
44114411
},
@@ -5594,7 +5594,7 @@
55945594
}
55955595
},
55965596
"colorscale": {
5597-
"description": "Sets the colorscale.",
5597+
"description": "Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)', [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in z space, use zmin and zmax",
55985598
"role": "style",
55995599
"valType": "colorscale"
56005600
},
@@ -6134,7 +6134,7 @@
61346134
}
61356135
},
61366136
"colorscale": {
6137-
"description": "Sets the colorscale.",
6137+
"description": "Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)', [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in z space, use zmin and zmax",
61386138
"role": "style",
61396139
"valType": "colorscale"
61406140
},
@@ -6781,7 +6781,7 @@
67816781
}
67826782
},
67836783
"colorscale": {
6784-
"description": "Sets the colorscale.",
6784+
"description": "Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)', [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in z space, use zmin and zmax",
67856785
"role": "style",
67866786
"valType": "colorscale"
67876787
},
@@ -7660,7 +7660,7 @@
76607660
}
76617661
},
76627662
"colorscale": {
7663-
"description": "Has only an effect if `marker.color` is set to a numerical array. Sets the colorscale.",
7663+
"description": "Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)', [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in color space, use cmin and cmax",
76647664
"role": "style",
76657665
"valType": "colorscale"
76667666
},
@@ -8307,7 +8307,7 @@
83078307
}
83088308
},
83098309
"colorscale": {
8310-
"description": "Sets the colorscale.",
8310+
"description": "Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)', [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in z space, use zmin and zmax",
83118311
"role": "style",
83128312
"valType": "colorscale"
83138313
},
@@ -8933,7 +8933,7 @@
89338933
}
89348934
},
89358935
"colorscale": {
8936-
"description": "Sets the colorscale.",
8936+
"description": "Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)', [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in z space, use zmin and zmax",
89378937
"role": "style",
89388938
"valType": "colorscale"
89398939
},
@@ -9617,7 +9617,7 @@
96179617
}
96189618
},
96199619
"colorscale": {
9620-
"description": "Sets the colorscale.",
9620+
"description": "Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)', [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in z space, use zmin and zmax",
96219621
"role": "style",
96229622
"valType": "colorscale"
96239623
},
@@ -10933,7 +10933,7 @@
1093310933
}
1093410934
},
1093510935
"colorscale": {
10936-
"description": "Has only an effect if `marker.color` is set to a numerical array. Sets the colorscale.",
10936+
"description": "Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)', [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in color space, use cmin and cmax",
1093710937
"role": "style",
1093810938
"valType": "colorscale"
1093910939
},
@@ -12308,7 +12308,7 @@
1230812308
}
1230912309
},
1231012310
"colorscale": {
12311-
"description": "Has only an effect if `marker.color` is set to a numerical array. Sets the colorscale.",
12311+
"description": "Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)', [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in color space, use cmin and cmax",
1231212312
"role": "style",
1231312313
"valType": "colorscale"
1231412314
},
@@ -13197,7 +13197,7 @@
1319713197
}
1319813198
},
1319913199
"colorscale": {
13200-
"description": "Has only an effect if `marker.color` is set to a numerical array. Sets the colorscale.",
13200+
"description": "Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)', [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in color space, use cmin and cmax",
1320113201
"role": "style",
1320213202
"valType": "colorscale"
1320313203
},
@@ -14428,7 +14428,7 @@
1442814428
}
1442914429
},
1443014430
"colorscale": {
14431-
"description": "Has only an effect if `marker.color` is set to a numerical array. Sets the colorscale.",
14431+
"description": "Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)', [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in color space, use cmin and cmax",
1443214432
"role": "style",
1443314433
"valType": "colorscale"
1443414434
},
@@ -15053,7 +15053,7 @@
1505315053
}
1505415054
},
1505515055
"colorscale": {
15056-
"description": "Sets the colorscale.",
15056+
"description": "Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)', [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in z space, use zmin and zmax",
1505715057
"role": "style",
1505815058
"valType": "colorscale"
1505915059
},

plotly/offline/offline.py

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def init_notebook_mode():
7272

7373

7474
def _plot_html(figure_or_data, show_link, link_text,
75-
validate, default_width, default_height):
75+
validate, default_width, default_height, **config_options):
7676

7777
figure = tools.return_figure_from_figure_or_data(figure_or_data, validate)
7878

@@ -97,9 +97,32 @@ def _plot_html(figure_or_data, show_link, link_text,
9797
jdata = json.dumps(figure.get('data', []), cls=utils.PlotlyJSONEncoder)
9898
jlayout = json.dumps(figure.get('layout', {}), cls=utils.PlotlyJSONEncoder)
9999

100-
config = {}
100+
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')
120+
121+
config = (dict((k, config_options[k]) for k in config_options
122+
if k in configkeys))
101123
config['showLink'] = show_link
102124
config['linkText'] = link_text
125+
103126
jconfig = json.dumps(config)
104127

105128
# TODO: The get_config 'source of truth' should
@@ -138,7 +161,7 @@ def _plot_html(figure_or_data, show_link, link_text,
138161

139162

140163
def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
141-
validate=True):
164+
validate=True, **config_options):
142165
"""
143166
Draw plotly graphs inside an IPython notebook without
144167
connecting to an external server.
@@ -186,7 +209,7 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
186209

187210
plot_html, plotdivid, width, height = _plot_html(
188211
figure_or_data, show_link, link_text, validate,
189-
'100%', 525)
212+
'100%', 525, **config_options)
190213

191214
display(HTML(plot_html))
192215

@@ -196,7 +219,7 @@ def plot(figure_or_data,
196219
validate=True, output_type='file',
197220
include_plotlyjs=True,
198221
filename='temp-plot.html',
199-
auto_open=True):
222+
auto_open=True, **config_options):
200223
""" Create a plotly graph locally as an HTML document or string.
201224
202225
Example:
@@ -255,7 +278,7 @@ def plot(figure_or_data,
255278

256279
plot_html, plotdivid, width, height = _plot_html(
257280
figure_or_data, show_link, link_text, validate,
258-
'100%', '100%')
281+
'100%', '100%', **config_options)
259282

260283
figure = tools.return_figure_from_figure_or_data(figure_or_data, validate)
261284

0 commit comments

Comments
 (0)