# Smooth plot of coarsely spaced table values [closed]

In a simpler first case I plotted reasonably spaced (stability) contours by selecting a sequence of k values,

k = {.0001, .025, .055, .1, .15, .2, .25, .3, .35, .4, .5, .6, .7, .8, 1., 1.4, 1.8, 2.2, 2.6, 3, 4, 6, 8, 16}


and computing an analytic function at those k with a color sequence matched.

Now in a more complicated case to compare with the original at the same k values and colors, the analytic function is replaced by numerical integration and asymptotic expansion.

I generated a table of the new function at those k values, but ListLinePlot of these entries vs k draws disjointed line segments between the table points. I just want a smooth curve with no kinks. I tried ListCurvePathPlot and Interpolation Order but they still left the kinks at the admittedly coarse last few data points. I can create a second display list with more data points to minimise the kinks, but use the original for my stability curves for comparison with my earlier case.

Would be very grateful for any suggestions of other simple things I can try at the plot stage as I have now been stuck for several hours on this simple problem. Thank you

• Please post the code you've written so far. May be helpful to understand what you are doing ... – mjw Mar 25 '19 at 4:09
• Also, clarify what you need exactly!!? Plotting Smooth curve as i got! Right!? – Alrubaie Mar 25 '19 at 14:16
• u/sdb2754 was trying to write a function that plots a cubic fit to a data set (similar to ListLinePlot, but with splines instead of lines). He had:ListSplinePlot[data_, x_] := Show[ListPlot[data], Plot[InterpolatingPolynomial[data, x], {x, Min[Transpose[data][[1]]], Max[Transpose[data][[1]]]}], PlotRange -> All, AxesOrigin -> {0, 0}] That doesn't work, I have lists of 2 element lists with the first element k, no implicit x. I don't see where he specified that the polynomial is a cubic. Above all I don't understand why Mathematica does not have a built in ListSplinePlot – simon Mar 25 '19 at 14:23
• @simon Are you looking for something like ListLinePlot[k, InterpolationOrder -> 3]? – MarcoB Mar 25 '19 at 14:32
• Do you have a sense of the error size of your numerical integration? Also, an underlying structure/parameterization of the curves you are trying to pass through the points? – MikeY Mar 25 '19 at 15:49

For your k table is the same

k = {.0001, .025, .055, .1, .15, .2, .25, .3, .35, .4, .5, .6, .7, .8,
1., 1.4, 1.8, 2.2, 2.6, 3, 4, 6, 8, 16};


this is the curve using ListLinePlot or Joined in ListPlot

ListPlot[k, Joined -> True]


but you want it smooth curve!!? Here is

First Method

As well you can change n in FitPolynomial or x in Plot to get more desired result.

this it the best smooth curve i get!

k = {0.0001, 0.025, 0.055, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.5, 0.6, 0.7, 0.8,
1., 1.4, 1.8, 2.2, 2.6, 3, 4, 6, 8, 16};

FitPolynomial[data_] := Fit[data, Table[x^n, {n, 0, 10}], x];
q = FitPolynomial[k];
p2 = Plot[q, {x, 1, 25}]

p1 = ListPlot[k]
Show[p1, p2]


Second Method

As well you can change order in InterpolationOrder

k = {.0001, .025, .055, .1, .15, .2, .25, .3, .35, .4, .5, .6, .7, .8,
1., 1.4, 1.8, 2.2, 2.6, 3, 4, 6, 8, 16};

p1 = ListPlot[k]
p2 = ListPlot[k, InterpolationOrder -> 5, PlotRange -> All,
Joined -> True]

Show[p1, p2]


• I am so sorry you misunderstood the problem, There is no implicit x, the k's are my preselected x values. I have lists of {k,f1}, {k,f2} values etc and need each list of points to be spline plotted. I will study your answer to see if there is something there I can use – simon Mar 25 '19 at 15:24