Skip to content
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

Interpolation for 3d data in plotly #423

Closed
vidhyadhari opened this issue Mar 11, 2016 · 3 comments
Closed

Interpolation for 3d data in plotly #423

vidhyadhari opened this issue Mar 11, 2016 · 3 comments

Comments

@vidhyadhari
Copy link

I need a way to create a smooth representation of 3d curves in plotly. Currently I have a set of points when I plot them I get step-wise points in plotly. Is there a way to avoid the step-wise variance in the plots and get a smooth curve?

I have thought of interpolation but it is smoothing out the curve completely by avoiding all the outliers.

Attaching the images.

screen shot 2016-03-11 at 2 54 39 pm
The blue line in this plot needs to be smoothed. It has lot of outliers which create that step effect when I plot that data.

Here is the output of interpolation:
5kdok
Before Interpolation.

tvndq
After Interpolation.

Any help on this would be great. Thanks.

@tarzzz
Copy link
Contributor

tarzzz commented Mar 12, 2016

You can set the line properties to spline in the trace:

Example:

import plotly.plotly as py
import plotly.graph_objs as go
import numpy as np

x = np.linspace(1,10,num=50)
y = np.random.rand(1,50)

trace = go.Scatter(x=x,y=y[0],mode='lines', line=go.Line(shape='spline')) # Line shape is 'spline' here ..
py.plot([trace])

This is how it renders: https://plot.ly/~tarzzz/1874/
:)

@vidhyadhari
Copy link
Author

@tarzzz : Thanks for the reply.

But the problem is the line.shape property is present in only 2d plots. I need a similar one for 3d line plots.

In 3d I used Scatter3d function instead of just Scatter and the line object doesn't have shape object in it.

@jackparmer
Copy link
Contributor

See:

no line.shape

In this issue: plotly/plotly.js#130 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants