have some 2D data in Julia representing a circular feature with some “holes” in it. I like to interpolate these holes by finding points fitting on a curve representing the shape of the feature.
Using Julia’s PlotlyJS
library I was able to find a nice spline
interpolation curve for the points visually. However, I am not able to “access” that interpolation to calculate the actual points required. Any (alternative?) idea on how to get that?
Here is a working example:
using PlotlyJS
someData = [
3.47336 -0.471233;
3.53109 0.335963;
3.46748 1.10433;
3.13369 1.87227;
2.33268 2.51022;
1.21804 3.07551;
0.211065 3.3075;
-0.768256 3.18599;
-1.72856 2.87655;
-2.55477 2.58726;
-3.28657 1.99779;
-3.63637 1.31502;
-3.56652 -0.462201;
-2.96175 -0.956073;
-2.0519 -0.870708;
-1.07193 -0.837913;
-0.156219 -0.972855;
0.594719 -1.4576;
1.27607 -1.9387;
2.08427 -2.17288;
3.47336 -0.471233
]
plot([
scatter(
x=someData[:,1], y=someData[:,2], type="scatter", mode="markers", name="Some data",
marker=attr(size=8, color="orange", opacity=1)
),
scatter(
x=someData[:,1], y=someData[:,2], type="scatter", mode="lines", name="Plotly spline",
line=attr(color="green", width=2, shape="spline")
),
], Layout(scene=attr(aspectmode="data"), showlegend=true)
)