-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Milestone
Description
When I specify a parameter that does not exist to the update_traces
method of a figure object, I get a comprehensive error message, which is excellent for troubleshooting and parameter discovery:
import plotly.express as px
iris = px.data.iris()
fig = px.scatter(iris, 'sepal_width', 'sepal_length', 'sepal_length')
fig.update_traces(test='asdf')
ValueError: Invalid property specified for object of type plotly.graph_objs.Scatter: 'testaa'
Valid properties:
cliponaxis
Determines whether or not markers and text nodes are
clipped about the subplot axes. To show markers and
text nodes above axis lines and tick labels, make sure
to set `xaxis.layer` and `yaxis.layer` to *below
traces*.
connectgaps
Determines whether or not gaps (i.e. {nan} or missing
values) in the provided data arrays are connected.
customdata
Assigns extra data each datum. This may be useful when
listening to hover, click and selection events. Note
that, "scatter" traces also appends customdata items in
the markers DOM elements
customdatasrc
Sets the source reference on plot.ly for customdata .
...
When I try the same thing with the update
method of a figure object, the error message is less useful.
import plotly.express as px
iris = px.data.iris()
fig = px.scatter(iris, 'sepal_width', 'sepal_length', 'sepal_length')
fig.update(test='asdf')
KeyError: 'test'
Particularly for these methods where the docstring cannot include an explanation of all the **kwargs parameters, it is highly useful to have the detailed error message and it would be great if it was possible to include it for the update
figure method.
Metadata
Metadata
Assignees
Labels
No labels