-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't mutate contours start/end/size into user traces #4199
Comments
If plotly is initiated with wrong selection , it ignores values and does not break var data = [{
z: [[10, 10.625, 12.5, 15.625, 20]],
type: "contour",
contours: {
start: 1000,
end: 1
}
}]; But when same option is called by var update = {
'contours.start': 1000,
'contours.end': 1,
};
Plotly.restyle("myDiv", update, 0); |
Thanks very much for reporting. This issue and #4201 have essentially the same cause: we mutate the input plotly.js/src/traces/contour/set_contours.js Lines 46 to 55 in be4e5a9
and plotly.js/src/traces/contour/set_contours.js Lines 62 to 74 in be4e5a9
In brief, Plotly.newPlot(gd, [{
z: [
[10, 10.625, 12.5, 15.625, 20],
[5.625, 6.25, 8.125, 11.25, 15.625],
[2.5, 3.125, 5, 8.125, 12.5],
[0.625, 1.25, 3.125, 6.25, 10.625],
[0, 0.625, 2.5, 5.625, 10]
],
type: "contour",
colorscale: "Jet",
ncontours: 15,
autocontour: false
}])
// gives
gd.data[0].contours // => {start: 2, end: 18, size: 2}
// ... as we copied in the "auto" contour computed values
// then
Plotly.restyle(gd, {'contours.start': 1000})
// gives
gd.data[0].contours // => {start: 1000, end: 18, size: 2} To solve this problem the right way, we'll need to implement "relink" logic similar to what #3341 did for colorscale attributes and what #3044 did for histogram bins. Note that in the meantime, using Plotly.restyle(gd, {contours: {start: 1000}})
// which replaces all of `gd.data[0].contours` with `{start: 1000}` and gives
gd.data[0].contours // => {start: 2, end: 18, size: 2}
// ... as start > end is not accepted might be a sufficient workaround. |
Moreover, we should probably make attributes plotly.js/src/traces/contour/attributes.js Lines 101 to 134 in be4e5a9
|
Hi - we are currently trying to tidy up Plotly's public repositories to help us focus our efforts on things that will help users most. Since this issue has been sitting for several years, I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our backlog. Thanks for your help - @gvwilson |
Demo: https://codepen.io/mafar/pen/NWKOxzr?editors=0010
This pen is bare minimum for bug reproduction
Explaination: https://plot.ly/javascript/reference/#contour
Consider a user is given 3 inputs where he has to set
and he types invalid option and plotly breaks
Required:
Instead of breaking, plotly must ignore values or throw warning
Image: wait to load
The text was updated successfully, but these errors were encountered: