docs: Add unsafe_update_figure doc#1058
Conversation
| > [!WARNING] | ||
| > `dx` maps `Table` columns to an index of a trace within `Figure.data` which will break if the trace order changes. Do not remove traces. Add new traces at the end of the list. | ||
|
|
||
| `unsafe_update_figure` accepts a function that takes a Plotly `Figure` object as input and optionally returns a modified `Figure` object. If a figure is not returned, it is assumed that the input figure has been modified in place. |
There was a problem hiding this comment.
Should link to full plotly.js docs where they can see figure docs
There was a problem hiding this comment.
done, linked on the first instance
| A Plotly [`Figure`](https://plotly.com/python/figure-structure/) object backs every `dx` chart, and `unsafe_update_figure` allows you to directly modify this object. | ||
|
|
||
| > [!WARNING] | ||
| > `dx` maps `Table` columns to an index of a trace within `Figure.data` which will break if the trace order changes. Do not remove traces. Add new traces at the end of the list. |
There was a problem hiding this comment.
I would directly state why it is labelled "unsafe" at the start of this warning.
Update figure is marked "unsafe" because some modifications can entirely break your figure, and care must be taken to not ...
There was a problem hiding this comment.
It might be helpful to explicitly call out the relationship of unsafe_update_figure to the plotly docs. I found it very confusing searching for update_figure in the plotly docs since I wrongfully assumed unsafe_update_figure was a wrapper for something with a similar name. I found the figure reference doc (https://plotly.com/python/reference/) to be a little more helpful in helping me find what I was looking for. It has more direct figure.update_xxx examples throughout.
I left a suggested change above.
|
@dsmmcken any further comments? |
Adds an
unsafe_update_figuredoc with some usages that I have been asked for or otherwise seen.