# TikZ: Add decoration on a smooth coordinates plot

I would like to draw a smooth curve that I get from a coordinate plot after adding some additional decorations. So far I have.

\begin{tikzpicture}
\path [blue] plot [smooth] coordinates { (0.2,0.2) (0.4,0.2) (0.6,0.22) (0.8,0.52) (1,0.22) (1.2,0.2) (1.4,0.2)} [postaction={draw,decorate,decoration={random steps, segment length = 0.4mm, amplitude = 0.5pt}}] (0.2,0.2) -- (1.4,0.2);
\end{tikzpicture}


This code however plots both the smooth line with the decoration and a line from (0.2,0.2) to (1.4,0.2)

-
Welcome to TeX.sx! – Peter Jansson Mar 5 '13 at 14:10
You should post a picture of what you're trying to achieve. – Jubobs Mar 5 '13 at 14:42
@jubobs He can't (not enough reputation), but he can provide a link to the image (uploaded to some pastebin) and I can insert it in the question. – JLDiaz Mar 5 '13 at 14:44
@Jubobs You can find some nice alternatives for such greeting comments in here meta.tex.stackexchange.com/questions/430/text-building-blocks – percusse Mar 5 '13 at 14:46
@Percusse Sorry, I'm relatively new to tex.stackexchange. Will do! – Jubobs Mar 5 '13 at 14:49

Remove the -- between the start and the end of the path. -- tells explicitly TikZ to draw a line between 2 points ...

\begin{tikzpicture}
\path [blue] plot [smooth] coordinates { (0.2,0.2) (0.4,0.2) (0.6,0.22) (0.8,0.52) (1,0.22) (1.2,0.2) (1.4,0.2)} [postaction={draw,decorate,decoration={random steps, segment length = 0.4mm, amplitude = 0.5pt}}] (0.2,0.2)  (1.4,0.2);
\end{tikzpicture}


Edit:

There seems to be a conflict between the smooth option and the postaction key, issuing several "Dimension too large", that can be ignored...

@Jubobs Very strange... With -- it compiles fine, removing -- should not do issue such an error... – Lionel MANSUY Mar 5 '13 at 14:57
@LionelMANSUY In any case, what is the difference between removing -- or removing the final part of the path, i.e. (0.2,0.2) -- (1.4,0.2) altogheter? If you remove the --, but leave the coordinates, you only cause the "plotting pen" to move without drawing. You can remove the coordinates too and get the same result. In fact, you'll get the same Dimension too large error :-( – JLDiaz Mar 5 '13 at 15:14
@JLDiaz The smooth option (with an open curve) uses control points with null distance at each extremity: it's a pity! – Paul Gaborit Mar 5 '13 at 15:45