[Tex/LaTex] Smooth curve through points with pgfplots

curve fittingpgfplots

I know that one can get smooth point connections with option smooth to \addplot that takes the previous and the next point into account, but this still connects all the points.

How can I draw a smooth curve through the points using pgfplots that are not necessarily connected? I'm not fully sure if this is correct, but I think I'm looking for "bezier curves" (correct me if wrong). To be clear: I do not want curve-fitting like one can do with gnuplot, just some "sloppy-smooth" connecting of points.

Example picture (not from my data!):

enter image description here

Here is my real data, they don't follow a known, analytical, mathematical function:

43  3.22
44  3.26
45  3.28
46  3.40
47  3.60
48  3.53
49  3.50
50  3.60
51  3.59
52  3.54
53  3.55
54  3.51
55  3.35
56  3.45
57  3.42
58  3.43
59  3.42
60  3.42
61  3.43
62  3.47
63  3.45
64  3.40
65  3.20
66  3.21
67  3.17
68  3.20
69  3.22
70  3.36
71  3.37
72  3.37
73  3.30
74  3.33
75  3.39
76  3.41
77  3.34
78  3.45
79  3.42
80  3.38
81  3.33
82  3.15
83  3.35
84  3.33
85  3.20
86  3.24
87  3.20

Best Answer

Using the gnuplot backend, put your points in a file.dat, and compile twice with -shell-escape

enter image description here

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
  \begin{axis}
    \addplot +[no markers, raw gnuplot] gnuplot {
        plot 'file.dat' smooth sbezier;
    };
    \addplot +[only marks, raw gnuplot] gnuplot {
        plot 'file.dat' with points;
    };
  \end{axis}
\end{tikzpicture}
\end{document}