You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/python/configuration-options.md
+15-227
Original file line number
Diff line number
Diff line change
@@ -5,8 +5,8 @@ jupyter:
5
5
text_representation:
6
6
extension: .md
7
7
format_name: markdown
8
-
format_version: '1.2'
9
-
jupytext_version: 1.3.2
8
+
format_version: '1.1'
9
+
jupytext_version: 1.2.1
10
10
kernelspec:
11
11
display_name: Python 3
12
12
language: python
@@ -20,10 +20,9 @@ jupyter:
20
20
name: python
21
21
nbconvert_exporter: python
22
22
pygments_lexer: ipython3
23
-
version: 3.7.0
23
+
version: 3.7.3
24
24
plotly:
25
-
description: How to set the configuration options of figures using Ploty's Python
26
-
graphing library.
25
+
description: How to set configuration options of plotly graphs in python.
27
26
display_as: file_settings
28
27
language: python
29
28
layout: base
@@ -34,150 +33,40 @@ jupyter:
34
33
thumbnail: thumbnail/modebar-icons.png
35
34
---
36
35
37
-
# Configuration Options
38
36
39
-
The `show()` method that you use to display your figures also accepts a `config` parameter.
40
-
41
-
You can set the configuration options for your figure by passing a dictionary to this parameter which contains the options you want to set.
42
-
43
-
If you don't set an option's value, it will be automatically be set to the default value for that option.
44
-
45
-
For the complete list of configuration options and their defaults see: https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js
37
+
You can pass a `config` dictionary with all configurations options such as `scrollZoom`, `editable`, and `displayModeBar`. For the complete list of config options check out: https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js
46
38
47
39
##### Enable Scroll Zoom
48
40
49
-
This option allows users to zoom in and out of figures using the scroll wheel on their mouse and/or a two-finger scroll.
50
-
51
41
```python
52
42
import plotly.graph_objects as go
53
43
54
44
fig = go.Figure()
55
45
56
-
config =dict({'scrollZoom': True})
57
-
58
46
fig.add_trace(
59
47
go.Scatter(
60
48
x=[1, 2, 3],
61
49
y=[1, 3, 1]))
62
50
63
-
fig.show(config=config)
51
+
fig.show(config={'scrollZoom': True})
64
52
```
65
53
66
-
##### Force The Modebar to Always Be Visible
67
-
68
-
When users hover over a figure generated with plotly.py, a modebar appears in the top-right of the figure. This presents users with several options for interacting with the figure.
69
-
70
-
By default, the modebar is only visible while the user is hovering over the chart. If you would like the modebar to always be visible regardless of whether or not the user is currently hovering over the figure, set the displayModeBar attribute in the configuration of your figure to true.
54
+
##### Display ModeBar
71
55
72
56
```python
73
57
import plotly.graph_objects as go
74
58
75
59
fig = go.Figure()
76
60
77
-
config = {'displayModeBar': True}
78
-
79
61
fig.add_trace(
80
62
go.Scatter(
81
63
x=[1, 2, 3],
82
64
y=[1, 3, 1]))
83
65
84
-
fig.show(config=config)
66
+
fig.show(config={'displayModeBar': True})
85
67
```
86
68
87
-
##### Never Display The Modebar
88
-
89
-
When users hover over a figure generated with `plotly.py`, a modebar appears in the top-right of the figure. This presents users with several options for interacting with the figure.
90
-
91
-
By default, the modebar is only visible while the user is hovering over the chart. If you would like the modebar to never be visible, then set the displayModeBar attribute in the config of your figure to false.
92
-
93
-
```python
94
-
import plotly.graph_objects as go
95
-
96
-
fig = go.Figure()
97
-
98
-
config = {'displayModeBar': False}
99
-
100
-
fig.add_trace(
101
-
go.Scatter(
102
-
x=[1, 2, 3],
103
-
y=[1, 3, 1]))
104
-
105
-
fig.show(config=config)
106
-
```
107
-
108
-
##### Display the `Edit Chart` Link
109
-
110
-
Set `showLink` to `True` in order to make your figure editable on [Chart Studio](https://plot.ly/online-chart-maker).
111
-
112
-
```python
113
-
import plotly.graph_objects as go
114
-
115
-
fig = go.Figure()
116
-
117
-
config = {'showLink': True}
118
-
119
-
fig.add_trace(
120
-
go.Scatter(
121
-
x=[1, 2, 3],
122
-
y=[1, 3, 1]))
123
-
124
-
fig.show(config=config)
125
-
```
126
-
127
-
### Display The `Edit In Chart Studio` Modebar Button
128
-
129
-
```python
130
-
import plotly.graph_objects as go
131
-
132
-
fig = go.Figure()
133
-
134
-
config = {'showEditInChartStudio': True}
135
-
136
-
fig.add_trace(
137
-
go.Scatter(
138
-
x=[1, 2, 3],
139
-
y=[1, 3, 1]))
140
-
141
-
fig.show(config=config)
142
-
```
143
-
144
-
##### Hide the Plotly Logo on the Modebar
145
-
146
-
```python
147
-
import plotly.graph_objects as go
148
-
149
-
fig = go.Figure()
150
-
151
-
config = {'displaylogo': False}
152
-
153
-
fig.add_trace(
154
-
go.Scatter(
155
-
x=[1, 2, 3],
156
-
y=[1, 3, 1]))
157
-
158
-
fig.show(config=config)
159
-
```
160
-
161
-
##### Making A Responsive Chart
162
-
163
-
```python
164
-
import plotly.graph_objects as go
165
-
166
-
fig = go.Figure()
167
-
168
-
config = {'responsive': True}
169
-
170
-
fig.add_trace(
171
-
go.Scatter(
172
-
x=[1, 2, 3],
173
-
y=[1, 3, 1]))
174
-
175
-
fig.show(config=config)
176
-
```
177
-
178
-
##### Editable Mode
179
-
180
-
In editable mode, users can edit the chart title, axis labels and trace names in the legend.
69
+
##### Edit Mode - change the title and axis titles
181
70
182
71
```python
183
72
import plotly.graph_objects as go
@@ -192,81 +81,27 @@ fig.add_trace(
192
81
fig.show(config={'editable': True})
193
82
```
194
83
195
-
##### Making A Static Chart
196
-
197
-
```python
198
-
import plotly.graph_objects as go
199
-
200
-
fig = go.Figure()
201
-
202
-
config = {'staticPlot': True}
203
-
204
-
fig.add_trace(
205
-
go.Scatter(
206
-
x=[1, 2, 3],
207
-
y=[1, 3, 1]))
208
-
209
-
fig.show(config=config)
210
-
```
211
-
212
-
##### Customize Download Plot Options
84
+
##### Multiple Config Options at Once!
213
85
214
86
```python
215
87
import plotly.graph_objects as go
216
88
217
89
fig = go.Figure()
218
90
219
-
config = {
220
-
'toImageButtonOptions': {
221
-
'format': 'svg', # one of png, svg, jpeg, webp
222
-
'filename': 'custom_image',
223
-
'height': 500,
224
-
'width': 700,
225
-
'scale': 1# Multiply title/legend/axis/canvas sizes by this factor
The dictionary that you use to specify configuration options for your figures can contain more than one configuration key/value pair.
240
-
241
-
```python
242
-
import plotly.graph_objects as go
243
-
244
-
fig = go.Figure()
245
-
246
-
config =dict({
96
+
fig.show(config={
247
97
'scrollZoom': True,
248
98
'displayModeBar': True,
249
99
'editable': True
250
100
})
251
-
252
-
fig.add_trace(
253
-
go.Scatter(
254
-
x=[1, 2, 3],
255
-
y=[1, 3, 1]))
256
-
257
-
fig.show(config=config)
258
101
```
259
102
260
103
##### Remove Modebar Buttons
261
104
262
-
To delete buttons from the modebar, pass an array of strings containing the names of the buttons you want to remove to the modeBarButtonsToRemove attribute in the figure's configuration dictionary. Note that different chart types have different default modebars. The following is a list of all the modebar buttons and the chart types they are associated with:
Sets the maximum delay between two consecutive clicks to be interpreted as a double-click in `ms`. This is the time interval between first mousedown and second mouseup. The default timing is 300 ms (less than half a second).
287
-
This setting propagates to all on-subplot double clicks (except for `geo` and `mapbox`).
120
+
### Double-click Delay
121
+
Sets the maximum delay between two consecutive clicks to be interpreted as a double-click in ms. This is the time interval between first mousedown, and' second mouseup. The default timing is 300 ms (less than half a second).
122
+
This setting propagates to all on-subplot double clicks (except for geo and mapbox).
The same configuration dictionary that you pass to the `config` parameter of the `show()` method can also be passed to the `config` parameter of a `dcc.Graph` component.
0 commit comments