14

How to draw figure of attached file in LaTex?

enter image description here

  • 5
    Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – Stefan Pinnow Sep 15 '19 at 17:09
26

Welcome. You can add random deformations on a smooth plot.

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[declare function={rr=1.5*(1+0.1*rnd);}]
 \draw[clip] plot[smooth cycle,variable=\t,samples at={0,45,...,315}] (\t:rr);
 \foreach \X [count=\Y starting from 0] in {red,blue,green!70!black}
 {\draw[\X] plot[smooth,variable=\t,samples at={0,0.25,...,1.75}] 
 (15+8*rnd+120*\Y:\t);
 }
\end{tikzpicture}
\end{document}

enter image description here

Surely you may animate this, too.

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\foreach \X in {1,...,42}
{\begin{tikzpicture}
 \path[use as bounding box] (-1.8,-1.8) rectangle (1.8,1.8);
 \draw[clip] plot[smooth cycle,variable=\t,samples at={0,45,...,315}] (\t:{1.5*(1+0.1*rnd)});
 \foreach \X [count=\Y starting from 0] in {red,blue,green!70!black}
 {\draw[\X] plot[smooth,variable=\t,samples at={0,0.25,...,1.75}] 
 ({15+6*(rnd-0.5)+120*\Y}:\t);
 }
\end{tikzpicture}}
\end{document}

enter image description here

| improve this answer | |
14

Just for fun purposes. Let other experts implement the randomly distorted radii.

\documentclass[pstricks]{standalone}
\usepackage{pst-node,pst-plot}

\begin{document}
\pstVerb{realtime srand}%
\psLoop{25}{%
\begin{pspicture}(-2,-2)(2,2)
    \curvepnodes[plotpoints=10]{0}{360}{Rand 5 div 1.5 add t PtoC}{P}
    \psnccurve(0,\numexpr\Pnodecount-1){P}
    \psline[linecolor=red](P0)
    \psline[linecolor=green](P3)
    \psline[linecolor=blue](P6)
\end{pspicture}}
\end{document}

enter image description here

Edit

No PSTricks, no party!

enter image description here

\documentclass[pstricks]{standalone}
\usepackage{pst-node,pst-plot}

\begin{document}
\pstVerb{realtime srand}%
\psLoop{10}{%
\begin{pspicture}[saveNodeCoors](-2,-2)(2,2)
    \curvepnodes[plotpoints=10]{0}{360}{Rand 1 add t PtoC}{P}
    \psnccurve(0,\numexpr\Pnodecount-1){P}
    \foreach \i/\c in {0/red,3/green,6/blue}{%
       \pnode(P\i){T}
       \curvepnodes[plotpoints=10]{0}{N-T.x N-T.y Pyth}{t Rand 0.5 sub 10 mul N-T.y N-T.x atan add PtoC}{Q}
       \psncurve[linecolor=\c](0,\Qnodecount){Q}}
\end{pspicture}}
\end{document}
| improve this answer | |
  • 1
    Actually I can make the randomly distorted radii using \curvepnodes but this page is too narrow for the extra code. – Too Fat Man No Neck Sep 15 '19 at 17:34
  • 1
    with package xfp: \fpeval{rand()*5} for real numbers between 0 and 5 – user187802 Sep 15 '19 at 17:53
  • @WellHarassedProgrammer: is that a reference to Fermat and his last theorem? – Tommiie Sep 16 '19 at 10:49
  • @Tommiie: You are well informed. :-) – Too Fat Man No Neck Sep 16 '19 at 11:43
  • 1
    @WellHarassedProgrammer: I very much like this theorem and when I find a book on it, I love reading it. – Tommiie Sep 16 '19 at 11:48

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.