# curve doesn't follow the point

I created this graph using pgfplot package. Here it is the code I used:

\begin{figure}[htp]
\centering
\begin{tikzpicture}
\begin{semilogxaxis}[xmin=1e-06,xmax=1e-01,xlabel=packet loss,ylabel=valore atteso,
grid=both,
legend pos = north west]
file {./MATLAB/grafici/valore_atteso/pure_network_coding/var_pkts_loss_probability/valore_atteso_20nodes_rlnc.txt};
\end{semilogxaxis}
\end{tikzpicture}
\end{figure}


here it is the result I got:

but unfortunately this is not the right graph. This because the file contains those values:

1e-06 1.0022
1e-05 1.0095
0.0001 1.0299
0.001 1.135
0.01 2.1753
0.1 46.922


The curve around 1e-3 and 1e-2 goes down. Why?

-
you have added the smooth option. –  percusse Dec 13 '12 at 13:59
yeah right...removing smooth it works...but why doesn't work using smooth option?it should follow simply the points –  Mazzy Dec 13 '12 at 14:02
If it follows the points then it cannot smoothen. The corners must be modified to be smooth and the degrees of freedom are fixed by the provided points of the curve. A final note I would not touch the data in any log plot (no matter how ugly it can be). The smallest changes are drastic in the actual magnitudes. –  percusse Dec 13 '12 at 14:03
The curve should go through all the points (try adding mark=* to see where your points are), but between the points, the curve changes of course, otherwise it wouldn't be smooth, as percusse said. –  Jake Dec 13 '12 at 14:05
mark size=<value> –  Jake Dec 13 '12 at 14:09

smooth option enables a path morphing mechanism such that the sharp corners are eliminated via some Bézier curve construction. As the name implies the curve is morphed into a smoother one. The only relation with the original curve is the given fixed points that define the curvature of the path while passing through those points.

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot+[] coordinates {(0,0) (1,1) (2,2) (3,0) (3.3,0.5)};
\addplot+[smooth,ultra thick] coordinates {(0,0) (1,1) (2,2) (3,0) (3.3,0.5)};
\end{axis}
\end{tikzpicture}
\end{document}


In drawings and schematics this is no big deal and can be used safely. However as you have found out, scientific plots should be given without any modification. Especially in the logarithmic plot cases the smallest deviations mean a lot in the linear scale.

-