'Update the style of existing traces in the Plotly graph.
Args:
update (dict):
dict where keys are the graph attribute strings
and values are the value of the graph attribute.
To update graph objects that are nested, like
a marker\'s color, combine the keys with a period,
e.g. `marker.color`. To replace an entire nested object,
like `marker`, set the value to the object.
See Example 2 below.
To update an attribute of multiple traces, set the
value to an list of values. If the list is shorter
than the number of traces, the values will wrap around.
Note: this means that for values that are naturally an array,
like `x` or `colorscale`, you need to wrap the value
in an extra array,
i.e. {\'colorscale\': [[[0, \'red\'], [1, \'green\']]]}
You can also supply values to different traces with the
indices argument.
See all of the graph attributes in our reference documentation
here: https://plot.ly/python/reference or by calling `help` on
graph objects in `plotly.graph_objs`.
indices (list, optional):
Specify which traces to apply the update dict to.
Negative indices are supported.
If indices are not given, the update will apply to
*all* traces.
Examples:
Initialization - Start each example below with this setup:
from plotly.widgets import GraphWidget
from IPython.display import display
graph = GraphWidget()
display(graph)
Example 1 - Set `marker.color` to red in every trace in the graph
graph.restyle({\'marker.color\': \'red\'})
Example 2 - Replace `marker` with {\'color\': \'red\'}
graph.restyle({\'marker\': {\'color\': red\'}})
Example 3 - Set `marker.color` to red
in the first trace of the graph
graph.restyle({\'marker.color\': \'red\'}, indices=[0])
Example 4 - Set `marker.color` of all of the traces to
alternating sequences of red and green
graph.restyle({\'marker.color\': [\'red\', \'green\']})
Example 5 - Set just `marker.color` of the first two traces
to red and green
graph.restyle({\'marker.color\': [\'red\', \'green\']}, indices=[0, 1])
Example 6 - Set multiple attributes of all of the traces
graph.restyle({
\'marker.color\': \'red\',
\'line.color\': \'green\'
Example 7 - Update the data of the first trace
graph.restyle({
\'x\': [[1, 2, 3]],
\'y\': [[10, 20, 30]],
}, indices=[0])
Example 8 - Update the data of the first two traces
graph.restyle({
\'x\': [[1, 2, 3],
[1, 2, 4]],
\'y\': [[10, 20, 30],
[5, 8, 14]],
}, indices=[0, 1])'

def restyle(self, update, indices=None):

    message = {'task': 'restyle', 'update': update, 'graphId': self._graphId}
    if indices:
        message['indices'] = indices
    self._handle_outgoing_message(message)
