How can I draw squiggles in TikZ to mock the plot of polynomials?

Enter image description here

  • TikZ understands commands like \draw[blue] plot[variable=\x,domain=0:1] ({2*\x+0.4*cos(\x*200)},{-0.7*sin(\x*540)}); that draw something like your "randomized" plots. – marmot Nov 13 at 18:44
up vote 8 down vote accepted
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{shapes.arrows}
\begin{document}
\begin{tikzpicture}
\begin{scope}[local bounding box=left]
\foreach \X  [count=\Y] in {green!60!black,yellow!80!orange,red}
{\draw[\X] plot[variable=\x,domain=0:1,smooth] ({2*\x},{0.7*sin(\x*540)+0.4*\x+2*(2-\Y)});}
\end{scope}
\begin{scope}[xshift=5cm,local bounding box=right]
\foreach \X  [count=\Y] in {green!60!black,yellow!80!orange,red}
{\draw[\X] plot[variable=\x,domain=0:1,smooth]
({2.5*\x+0.5*cos(\x*200)},{-0.7*sin(\x*540)+2*(2-\Y)});}
\end{scope}
\path (left.east) -- (right.west) 
node[midway,font=\sffamily,single arrow, draw]{randomize};
\end{tikzpicture}
\end{document}

enter image description here

  • Thanks. There are so much I don't know about tikz... – qweruiop Nov 13 at 19:06
  • 6
    @qweruiop I guess you are in good company because I think that this statement applies to everyone but at most 5 people (Till Tantau and a few others). – marmot Nov 13 at 19:07

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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