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

\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);

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. – jub0bs 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! – jub0bs 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 ...

\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);

enter image description here


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

Edit2: about closed path

The smoothing of the curves needs to compute other utility points. When the path is closed, you can consider that you do not have a beginning and an ending: all points of the path have a predecessor and a successor.

When the path is opened, the point in the beginning does not have a predecessor, and TikZ seem here to use a predecessor equal to this point, resulting a segment of zero width. But this segment is treated by your postaction decoration, issuing an error of calculation, with no incidence on the result.

difference between open and closed path

  • I get an "Dimension too large" error. Could you post the complete code? – jub0bs Mar 5 '13 at 14:48
  • I'll check this; I'm using TexMaker that doesn't display these errors... – Lionel MANSUY Mar 5 '13 at 14:53
  • @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
  • 3
    @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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.