-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add monotone spline support (and maybe other spline modes) #993
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
Comments
Yep, that would be nice. Thanks for the suggestion! |
From @Animus451 in #2085:
@rreusser's response:
I'd probably vote for all of these options to become different I'll note that the monotone algorithm implemented by d3 is a bit funny - it can still give extrema that aren't quite data values (if it did, each local extreme data point would need to have the curve pass through it with exactly zero derivative), and has some strangely unstable behavior as points pass each other in y value. So we may want to revisit exactly how that should work before we blindly copy or use it. |
I just posted this in a Julia package for interpolations, but you guys may be interested as well.
Regarding the comment by @alexcjohnson:
Yeah, that is funny. I just tested my code by dragging breakpoints just like you did. Both algorithms are nice and stable. |
@niclasmattsson thanks! Maybe the most useful way to share it is as a gist - and if a gist is formatted right with some example usage, it can be shared in action via blocks Plotly staff are pretty swamped for the next few months, but if anyone is itching to get this into plotly.js soon we'd happily review a PR :) |
Thanks for the tips @alexcjohnson, I didn't know it was so easy to get an interactive demo online using the gist/bl.ocks combo! I already had a working demo on my computer, so it was just a matter of writing a README and uploading it. Please have a look at my spline playground. While I was at it I also added a third algorithm for monotonic cubic splines (Steffen). As for getting something into Plotly.js, I'm in no hurry. After all, I have my own code. :) But I do hope someone finds this useful enough to put into Plotly at some point! |
@niclasmattsson thanks! Those indeed look like exactly what we would want for monotonic splines - they have small differences but all behave quite nicely. |
Is this still being considered? I am just getting started with plotly, and prefer the spline styling; however the splines sometimes drop below the minimum axis value and therefore do not look very pleasing. |
Not really on our roadmap, but if anyone would like to make a PR to add this we'd happily support and help get it merged. |
Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories 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 stack. Cheers - @gvwilson |
Hi :)
I've been trying to solve this issue:
https://jsfiddle.net/ro3c1gwx/
as you can see, when the line is 'spline', so it curves between equal values.
in this example, the line curves below the X axis for example.
I've found out that there's a new algorithm - called 'b-spline' or 'basis'.
http://bl.ocks.org/mbostock/4342190
With the example above i can use 'monotone', which exactly implements the line shape i'm looking for.
Thank you :)
The text was updated successfully, but these errors were encountered: