@@ -257,7 +257,9 @@ def restyle(self, data, indices=None):
257
257
258
258
To update graph objects that are nested, like
259
259
a marker's color, combine the keys with a period,
260
- e.g. `marker.color`
260
+ e.g. `marker.color`. To replace an entire nested object,
261
+ like `marker`, set the value to the object.
262
+ See Example 2 below.
261
263
262
264
To update an attribute of multiple traces, set the
263
265
value to an list of values. If the list is shorter
@@ -293,40 +295,46 @@ def restyle(self, data, indices=None):
293
295
graph.restyle({'marker.color': 'red'})
294
296
```
295
297
296
- Example 2 - Set `marker.color` to red in the first trace of the graph
298
+ Example 2 - Replace `marker` with {'color': 'red'}
299
+ ```
300
+ graph.restyle({'marker': {'color': red'}})
301
+ ```
302
+
303
+ Example 3 - Set `marker.color` to red
304
+ in the first trace of the graph
297
305
```
298
306
graph.restyle({'marker.color': 'red'}, indices=[0])
299
307
```
300
308
301
- Example 3 - Set `marker.color` of all of the traces to
309
+ Example 4 - Set `marker.color` of all of the traces to
302
310
alternating sequences of red and green
303
311
```
304
312
graph.restyle({'marker.color': ['red', 'green']})
305
313
```
306
314
307
- Example 4 - Set just `marker.color` of the first two traces
315
+ Example 5 - Set just `marker.color` of the first two traces
308
316
to red and green
309
317
```
310
318
graph.restyle({'marker.color': ['red', 'green']}, indices=[0, 1])
311
319
```
312
320
313
- Example 5 - Set multiple attributes of all of the traces
321
+ Example 6 - Set multiple attributes of all of the traces
314
322
```
315
323
graph.restyle({
316
324
'marker.color': 'red',
317
325
'line.color': 'green'
318
- }, indices=[0, 1] )
326
+ })
319
327
```
320
328
321
- Example 6 - Update the data of the first trace
329
+ Example 7 - Update the data of the first trace
322
330
```
323
331
graph.restyle({
324
332
'x': [[1, 2, 3]],
325
333
'y': [[10, 20, 30]],
326
334
}, indices=[0])
327
335
```
328
336
329
- Example 7 - Update the data of the first two traces
337
+ Example 8 - Update the data of the first two traces
330
338
```
331
339
graph.restyle({
332
340
'x': [[1, 2, 3],
0 commit comments