PlotlyWidget.update

PlotlyWidget.update(dict1=None, overwrite=False, **kwargs)

Update the properties of the figure with a dict and/or with keyword arguments.

This recursively updates the structure of the figure object with the values in the input dict / keyword arguments.

Parameters
  • dict1 (dict) – Dictionary of properties to be updated

  • overwrite (bool) – If True, overwrite existing properties. If False, apply updates to existing properties recursively, preserving existing properties that are not specified in the update operation.

  • kwargs – Keyword/value pair of properties to be updated

Examples

>>> import plotly.graph_objs as go
>>> fig = go.Figure(data=[{'y': [1, 2, 3]}])
>>> fig.update(data=[{'y': [4, 5, 6]}]) 
Figure(...)
>>> fig.to_plotly_json() 
    {'data': [{'type': 'scatter',
       'uid': 'e86a7c7a-346a-11e8-8aa8-a0999b0c017b',
       'y': array([4, 5, 6], dtype=int32)}],
     'layout': {}}
>>> fig = go.Figure(layout={'xaxis':
...                         {'color': 'green',
...                          'range': [0, 1]}})
>>> fig.update({'layout': {'xaxis': {'color': 'pink'}}}) 
Figure(...)
>>> fig.to_plotly_json() 
    {'data': [],
     'layout': {'xaxis':
                {'color': 'pink',
                 'range': [0, 1]}}}
Returns

Updated figure

Return type

BaseFigure