I am attempting to draw a squiggly circle in order to delineate an area of a figure, but in a manner that emphasizes the arbitrariness of the precise boundary - something like the circle below, but more distorted and random. I cannot figure out a good way of approaching this with TikZ - any suggestions?

enter image description here

| improve this question | | | | |

How about

\begin{tikzpicture}[declare function={rr=1+0.1*rnd;}]
 \draw plot[smooth cycle,variable=\t,samples at={0,45,...,315}] (\t:2*rr);

enter image description here

You can make it a pic, and thus make the "randomness" parameters like amplitude or the number of samples.

\begin{tikzpicture}[pics/random circle/.style={code={
  \tikzset{random circle/.cd,#1}
  \def\pv##1{\pgfkeysvalueof{/tikz/random circle/##1}}% 
  \draw plot[smooth cycle,variable=\t,samples at={0,\nextt,...,\lastt}] 
 }},random circle/.cd,radius/.initial=1,amplitude/.initial=0.1,
 \path (0,0) pic{random circle} 
    (4,0) pic[blue]{random circle={radius=2,amplitude=0.3,samples=12}}
    (0,-4) pic[red]{random circle={radius=2,amplitude=0.5,samples=16}};

enter image description here

| improve this answer | | | | |
  • How would I make the "squiggly circles" thicker. I tried adding thick, and even very thick, as in: \draw plot[very thick,smooth cycle,variable=\t,samples at={0,\nextt,...,\lastt}] .... However, this seems to have no effect. – murray Mar 3 at 17:29
  • @murray You add very thick to the options of plot. However, you need \draw[very thick] plot[smooth cycle,variable=\t,samples at={0,\nextt,...,\lastt}] .... Yet, if you use the pic, you only need pic[very thick]{random circle}. – Schrödinger's cat Mar 3 at 17:31

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.